
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
generator-apirest
Advanced tools
RESTful API generator using NodeJS, Express and MongoDB. Fork from https://github.com/diegohaz/generator-rest
RESTful API generator using NodeJS, Express and Mongoose
q, page, limit, fields etc. already provided by querymenFirst, install Yeoman and generator-rest using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-rest
Then, you can use yo to generate your project.
yo rest # generate a new project
yo rest:api # generate a new api endpoint inside your project
After you generate your project, these commands are available in package.json.
npm run dev # run the API in development mode
npm run prod # run the API in production mode
npm run docs # generate API docs
npm run swagger # generate API swagger
You can customize the src and api directories.
src/
├─ api/
│ ├─ user/
│ │ ├─ controller.js
│ │ ├─ index.js
│ │ ├─ model.js
│ └─ index.js
├─ services/
│ ├─ express/
│ ├─ facebook/
│ ├─ mongoose/
│ ├─ passport/
│ ├─ sendgrid/
│ └─ your-service/
├─ app.js
├─ config.js
└─ index.js
Here is where the API endpoints are defined. Each API has its own folder.
It defines the Mongoose schema and model for the API endpoint. Any changes to the data model should be done here.
This is the API controller file. It defines the main router middlewares which use the API model.
This is the entry file of the API. It defines the routes using, along other middlewares (like session, validation etc.), the middlewares defined in the some-endpoint.controller.js file.
Here you can put helpers, libraries and other types of modules which you want to use in your APIs.
FAQs
RESTful API generator using NodeJS, Express and MongoDB. Fork from https://github.com/diegohaz/generator-rest
The npm package generator-apirest receives a total of 1 weekly downloads. As such, generator-apirest popularity was classified as not popular.
We found that generator-apirest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.