Out of the box structure for an API
- Express
- Authentication and Authorization: PassportJS with JWT
- Testing: Mocha and Chai
- Data persistence:
4.1. Mongo with mongodb driver;
4.2. PostgreSQL with pg driver and Sequelize ORM. - Validation: Joi
- Documentation: Swagger
npm i generate-node-api -g
- Go to a directory where you want to start a project;
- Run
generate-node-api
in your terminal or command prompt; - Type a project name when your are prompted;
- Select one of the boilerplates:
4.1. Mongo - the boilerplate will need a mongo URI and DB to connect to. The tables must be created manually;
4.2. Postgres - the boilerplate will need a PostgreSQL database. You can run the migration to initialize the tables;
4.3. API - the boilerplate is useful to microservices which do not have direct access to a database. In this case, for data persistence purposes, some third party API will be called. - Open the directory with that project name
- Follow the instructions from the README file
- Happy coding!