express latest version code example
Example 1: npm express
$ npm install express
Example 2: express js server
const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;
app.get('/', (req, res) => {
res.send('<h1>Some HTML</h1>');
res.send('<p>Even more HTML</p>');
});
app.listen(PORT, () => console.log(`Server is listening on port ${PORT}`));
Example 3: npm express
const express = require('express');
const app = express();
app.get('/', (req, res)=> {
res.send('Hello World');
})
app.listen(3000,()=>{
console.log("starting...");
});