Boilerplate for REST API, that can be used as a starting point for various projects based on REST APIs with users related functions already implemented.
The code is based on Node.js, Express and MongoDB. In terms of testing there is also Mocha framework inital configuration added.
- bcrypt
- chai
- dotenv
- express
- jsonwebtoken
- mocha
- mongo-sanitize
- mongoose
- supertest
- Install it globally with command
npm i create-nem-api -g
- Create new project with command
npx create-nem-api <nameofyourapp>
Users routes can be found here
Source code can be found here
- After cloning the repository install dependencies with the command
npm install
/yarn install
- Create
.env
file in the main directory - Create MongoDB cluster and database.
- Add your database address to the .env file as
MONGO_URI=<yourDBaddress>
- Add test database address to the .env file as
MONGO_URI_TEST=<yourDBaddress>
- Add SendInBlue API key to the .env file as
SI_APIKEY=<yourSendInBlueAPIaddress>
- Add SendInBlue email address to the .env file as
SI_EMAIL=<yourSendInBlueEmailAddress>
- Add SendInBlue SMTP Endpoint, port, and sender addresses as
SMTP_ENDPOINT=<smtpEndpoint>
SMTP_PORT=<smtpPort>
SENDER_EMAIL=<email>
- Add JWT secret key (it's up to your personal choice) to the .env file as
JWT_SECRET=<yourJWTsecretKey>
- Type in
npm start
to run the server