Verify if nodejs installed on the local environment or not:
node -v npm -v
If not, install it first
- Getting to the node API folder and initial npm:
cd nodeapp
npm init
- Install express & nodemon
npm i express
npm i -g nodemon
- Open the package.json file and add this task to the script
"start": "nodemon server.js"
- start server:
npm run start
Nodejs API server start on 8080
Get books:
URL: http://localhost:8080/api/books/
Method: GET
Add book:
URL: http://localhost:8080/api/books/
Method: POST
request body:
{"name":"mybook"}