Service to create and authenticate users using Node.js.
- [Required] Node.js
- [Required] Express.js
- [Required] Passport.js
- [Required] MongoDB
- [Required] Jest
If you want to run in your local
If you want to run with docker
- [Required] Docker desktop
- Localhost http://localhost:3000
All commands are run from the root of the project, from a terminal:
| Command | Action |
|---|---|
nvm use |
Use the assigned node and npm versions |
npm install |
Installs dependencies |
npm start |
Starts local dev server at localhost:3000 |
npm run test |
Run project tests |
npm run test:watch |
Run project tests in watch mode |
npm run test:coverage |
Run project tests to see its coverage |
npm run lint |
Run eslint to find problems in the code |
You must to have a file in the root, named .env.local with the next variables:
PORT=3001
MONGODB_URI=[YOUR_MONGO_DB_URI]
JWT_SECRET=[YOUR_JWT_SECRET]
JWT_EXPIRES_IN=[YOUR_JWT_EXPIRES]
NODE_ENV=['development'|'production']
For the JWT_EXPIRES_IN syntax see jsonwebtoken documentation.
Then run the next commands:
nvm use
npm install
npm start
By default, the service is going to be exposed on http://localhost:3000.
You must to have a file in the root, named .env.local with the next variables:
PORT=3000
MONGODB_URI=[YOUR_MONGO_DB_URI]
MONGODB_PORT=[YOUR_MONGO_DB_PORT]
MONGODB_USERNAME=[YOUR_MONGO_DB_USERNAME]
MONGODB_PASSWORD=[YOUR_MONGO_DB_PASSWORD]
JWT_SECRET=[YOUR_JWT_SECRET]
JWT_EXPIRES_IN=[YOUR_JWT_EXPIRES]
NODE_ENV=['development'|'production']
Then run the next commands:
npm run docker:build
For the JWT_EXPIRES_IN syntax see jsonwebtoken documentation.
npm run docker:up
By default, the service is going to be exposed on http://localhost:3000.