Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pauldb09/api-template
A simple and beginner friendly api template built in nodejs and expressjs. Rate limite system
https://github.com/pauldb09/api-template
Last synced: 27 days ago
JSON representation
A simple and beginner friendly api template built in nodejs and expressjs. Rate limite system
- Host: GitHub
- URL: https://github.com/pauldb09/api-template
- Owner: pauldb09
- Created: 2022-04-16T13:05:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-22T17:03:42.000Z (over 2 years ago)
- Last Synced: 2023-03-03T21:03:19.734Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 561 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Api Template
A simple and beginner friendly api template built in nodejs and expressjs. Rate limite system included# Installation
Downdload the files, install nodejs on your computer ( nodejs.org ) and run it with `node app.js`
If you need any help, join this server: [discord.gg/Q5QSbAHaXB](https://discord.gg/Q5QSbAHaXB)
# Configuration
You can customize the settings in the `config.js` in [the line 5](https://github.com/pauldb09/Api-Template/blob/7319f8fac84395106afa31cdd24b0475756b9c78/app.js#L4) .
For the rate limite system, 4 req/s is a good value depening on the use you want to make of this.
You can create new routes by creating a file in the `routes` folder. Example route:
```js
const { Router } = require('express');
module.exports.Router = class Home extends Router {
constructor() {
super();
this.get('/', async function(req, res) {
res.status(200).send("Hello")
});this.post('/', async function(req, res) {
console.log("Got a post request");
});
}
};module.exports.name = '/test';
```