With express-constructor
you can build faster any kind of API. You only need to specify the routes an that's it, we help you to generate the built in code that you need.
Do not forget to check our roadmap, here we add all the features were working on at the moment. We appreciate all the help :)
npm i express-constructor
- Create a
routes.json
file specifying all your routes needed, like in the following example:
{
"appName": {
"root": "/",
"routes": [
{
"method": "path"
}
]
}
}
- Run the following command from the root folder.
constructor --port=customOptionalPort
- Start coding!
Imagine you need an api where you'll be handling users session, and also, product prices. You may need something like this:
{
"users": {
"root": "users/",
"routes": [
{
"post": "login/"
},
{
"post": "logout/"
}
]
},
"products": {
"root": "products/",
"routes": [
{
"get": "get_all/"
},
{
"post": "update/:productId"
}
]
}
}
With that, express-constructor will build something like:
yourFolder
│ package.json
│ index.js
│ .gitignore
└───src
│ │
│ └───products
│ │ index.js
│ │ routes.js
│
└─────users
│ index.js
│ routes.js
And that structure will have the following urls
/users/login
/users/logout
...
/products/get_all/
/products/:productId/