Multiple Simultaneous Servers

Since you have full control of express instance lifecycle, it's not a problem to create a few multiple simultaneous servers (e.g. both HTTP & HTTPS). Example:

let httpsOptions = {
    key: fs.readFileSync("./secrets/private-key.pem"),
    cert: fs.readFileSync("./secrets/public-certificate.pem")
};

const server = express();
const app = NestFactory.create(ApplicationModule, server);
app.init();

http.createServer(server).listen(3000);
https.createServer(httpsOptions, server).listen(443);

results matching ""

    No results matching ""