const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
const express = require("express");
const cors = require("cors");
require("dotenv").config();
const port = process.env.PORT || 5000;
const app = express();
//middle ware
app.use(cors());
app.use(express.json());
app.get("/", (req, res) => {
res.send("server is up");
});
app.listen(port, () => {
console.log("server is running");
});
nodemon start
/*do not use npm start*/
//jshint esversion:6
const express = require("express");
const bodyParser = require("body-parser");
const ejs = require("ejs");
const mongoose = require('mongoose');
const app = express();
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(express.static("public"));
//TODO
app.listen(3000, function() {
console.log("Server started on port 3000");
});