- Create a new folder and call it hello_world.
mkdir hello_world
cd hello_world
- In your hello_world folder create a new file called app.js
touch app.js
Note: you can install node here and
then run cmd with npm init ()
press enter for continue.
enter cmd with npm install express --save
Add content to file app.js
//Require module const express = require('express'); // Express Initialize const app = express(); const port = 8000; app.listen(port,()=> { console.log('listen port 8000'); }) //create api app.get('/hello_world', (req,res)=>{ res.send('Hello World'); })
Test: with browser: http://localhost:8000/hello_world
Check postman
input: http://localhost:3000/hello_world and then click The send button