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
1app.post('/signup', async(req, res) => {
2 const { email, firstName } = req.body
3 const user = new User({ email, firstName })
4 const ret = await user.save()
5 res.json(ret)
6})
7
1var express = require('express');
2var fs = require('fs');
3var app= express();
4 app.get('/index/profile/:id',function(req,res){
5 // res.send('profile with id' + req.params.id)
6
7
8
9 });
10app.listen(3000,'127.0.0.1');
11console.log('lsitng');