A simple express app with get /hello api upon surfing returns a json object containing "hello world!" message and status 200.
git clone https://github.com/YadamVinay369/errsole_first_task.git
cd errsole_first_task
code .
npm i express nodemon
Start the server by entering the command below into the vscode terminal.
npm run server
In the package.json file, I have added explicitly
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"server": "nodemon server.js"
},
Now to run the server, we can simply use the command
npm run server
instead of
nodemon server.js
After starting the server, open any browser and surf the below API.
http://localhost:5000/hello