Answers for "default express structure"

0

default express structure

const express = require('express')
const cors = require('cors')
const bodyParser = require('body-parser')
require('dotenv').config()
const ObjectId = require("mongodb").ObjectId;

const app = express()
app.use(cors())
app.use(express.json())
const port = process.env.PORT || 5000;

app.get('/', (req, res)=>{
    res.send('welcome to backend')
})

app.listen(port, () => {
    console.log(`App listening at localhost:${port}`);
})
Posted by: Guest on June-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language