seoblog lecture 1

seoblog lecture 1

Written by kanwar dhillon | Published 4 months ago

const express =require('express');


const morgan =require('morgan');

const bodyParser =require('body-parser');

const cookieParser =require('cookie-parser');

const cors =require('cors');


require('dotenv').config();


//app

const app =express();


//middlewares

app.use(morgan('dev'));

app.use(bodyParser.json());

app.use(cookieParser());


app.use(cors());


//routes

app.get('/api',(req,res)=>{

    res.json({time:Date().toString()})

});


const port =process.env.PORT||8000;

app.listen(port,()=>console.log(`server running on port ${port}`));



RELATED BLOGS