My personal template for my apirest in node
- Execute in your terminal
yarn
ornpm i
- Finally execute
yarn start
ornpm start
You can add actions editing the file action.js
with this syntax:
{
id: 'user',//The url for your endpoint example localhost:3000/api/user
type: 'post',//The http method you have post, get, put & delete
callback: (req, res) => {
//TODO: The callback for request & response
}
}
You can change the app port in the index.js
editing the const app