create a server in express js code example
Example 1: how to make an express server
const express = require('express');
const app = express();
app.get('/', (req,res)=>{
res.send('This is the home page!');
});
let PORT = 3000;
app.listen(PORT)
Example 2: create express server local
'use strict';
const express = require('express');
const app = express();
app.use(express.static('public'));
app.use(express.json());
app.get('/', function(req,res){
res.send('This is the Homepage');
});
app.listen(3000);