Reputation: 86
What is the difference and what is the most correct and latest way when creating a server with nodejs express?
const express = require('express');
const app = express();
app.listen(process.env.PORT || 3000, function () {
console.log('server running')
});
and the second way
const express = require('express');
const app = express();
const server = require('http').createServer(app)
server.listen(process.env.PORT || 3000, function () {
console.log('server running')
});
Upvotes: 0
Views: 40