1//to run : node filename.js
2const express = require('express')
3const app = express()
4const port = 3000
5
6app.get('/', (req, res) => res.send('Hello World!'))
7
8app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
9
10//visit localhost:3000
11// assuming you have done 1) npm init 2) npm install express
1const express = require('express')
2const app = express()
3const port = 3000
4
5app.get('/', (req, res) => res.send('Hello World!'))
6
7app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
8
1const express = require('express')const app = express() app.get('/', function (req, res) { res.send('Hello World')}) app.listen(3000)
1var express=require('express');
2var app=express();
3
4app.get('/',function(req,res){
5 res.send("Hello World!");
6});
7
8var server=app.listen(3000,function() {});
9