I wrote code below and I have a TypeError: Server is not a constructor and I don't see why and how to fixe it.
Server.js code :
const express = require('express');
class Server {
constructor() {
this.app = express();
this.app.get('/', function(req, res) {
res.send('Hello World');
})
}
start() {
this.app.listen(8080, function() {
console.log('MPS application is listening on port 8080 !')
});
}
}
app.js code :
const Server = require('./Server');
const express = require('express');
const server = new Server();
server.start();
Server.js? what does app.js say when you ask it toconsole.log(Server)module.exports = Serverat the end of yourServer.jscode