The objective of the project is to create a basic Express backend exposing a REST API
Development and production dependencies:
"scripts": {
"start": "node --require 'babel-register' src/index.js",
"lint": "standard 'src/**/*.js'",
"build": "babel src -d dist",
"watch": "nodemon",
"test": "NODE_ENV=test mocha --compilers js:babel-register --timeout 10000 tests/"
},
"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
"mocha": "^5.0.4",
"nodemon": "^1.14.12",
"pm2": "^2.10.1",
"supertest": "^3.0.0"
},
"dependencies": {
"body-parser": "^1.18.2",
"cors": "^2.8.4",
"dotenv": "^5.0.1",
"express": "^4.16.3",
"jwt-simple": "^0.5.1",
"morgan": "^1.9.0",
"ws": "^5.0.0"
}
Api development using Postman
Securization with token using jwt-simple
npm install --save-dev supertest mocha
express-rest-app
|- node_modules
...
.gitignore
package-lock.json
package.json
README.md
In the project directory, you can run:
Runs the app in the development mode. Open http://localhost:9000 to view it in the browser.
Runs the app with nodemon. Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development.
Note that the development server must be stopped to run the tests.
Transpile the code to the configured node version. From the 'src' folder to the 'dist' folder.
Monitoring the node server with pm2.