make-express-api
v1.0.5
Published
'make-express-api' is a cli tool which help back-end developers to generate express api faster. By writing a single line of code, developer will be able to create CRUD api for a specific module. This tool not only will generate the API, it will take care
Downloads
5
Maintainers
Readme
Make-Express-API
**********{ make-express-api }**********
"make-express-api" is a cli tool which help back-end developers to generate express api faster. By writing a single line of code, developer will be able to create CRUD api for a specific module. This tool not only will generate the API, it will take care of proper folder structure as well as versioning system. By default the rest api is designed by following "Rechardson standard level". Right now user won't be able to change it whether they are rewriting the api response.
Contribute
This is an open source project. Anybody can contribute with this project. If any of you want to contribute with this project to help express developer community, you guys are welcome.
Authors
Hi, I am Muhimenul Tareque, who developed the entire system inspired by RoR scaffold system. To know more you can visit the link bellow. Thank you.
How to use
It is very simple to use this application. To use this application just follow the instructions mentioned bellow:
- Download the package within your express project
npm i make-express-api
- Create a config file called
scaffold.config.js
at root directory of your project. - Add this with
package.json
"scripts": {
"scaffold": "create-scaffold"
}
- Add the following option into the config file.
module.exports = {
language: "js", // value=> js
folders: {
route: "routes", // routig folder name
controller: "controllers", // controller folder name
service: "repositories" //service folder name
}
};
If you done the step written above, you are good to make api's using
make-express-api
app.Open your terminal and run the following command from the root of the project directory.
npm run scaffold -- -v <version> -m <module_name>
Example:npm run scaffold -- -v v1 -m books
Now your API's are ready. It's time to connect the api with main file.
Open your main file index.js or app.js and import the router from the route file.
Add
app.use('books/v1/', booksRouter)
Limitations
The application has some limitations, as you are going to use this, you should keep it mind:
- Till now, the application only able to create CRUD for a module.
- You won't abe to create a single api.
- If already exist any module wihtin the same, the existing one will be replaced.
Next Version
The upcoming Version will solve the current limitations. Like:
- Developer will be able to create a single api's;
- Developer will be able to generate custom structure;