install dependencies:
npm install express
npm install cors
Create a start script on package.json file:
"scripts": {
"start": "node src/app.js"
},
run the server
npm install
and
npm start
or
node src/server.js
curl -X GET http://localhost:4001/
curl -X POST http://localhost:4001/ -H 'Content-Type: application/json' -d "{\"temperature\": 42}"
curl -X DELETE http://localhost:4001/
curl -X PUT http://localhost:4001/<temperature>?id=<id>
curl -X GET http://localhost:4001/<id>
curl -X DELETE http://localhost:4001/query?id=<id>
curl -X POST http://localhost:4001/temperature -H 'Content-Type: application/json' -d "{\"temperature\": <value>}"
curl -X GET http://localhost:4001/temperature
curl -X GET http://localhost:4001/temperature/<id>
curl -X PUT http://localhost:4001/temperature/<temperature>?id=<id>
curl -X DELETE http://localhost:4001/temperature
curl -X DELETE http://localhost:4001/temperature/query?id=<id>
chrome: http://localhost:4001/