Monday 5 June 2017

Nodejs express listener must be a function

I am using the following code to set up an express project, but I get an exception: TypeError: listener must be a function

var fs = require('fs');
var express = require('express');
var privateKey  = fs.readFileSync('C:/Node/cert/sn_com.key', 'utf8');
var certificate = fs.readFileSync('C:/Node/cert/sn_com.cer', 'utf8');
var credentials = {key: privateKey, cert: certificate};
var app = express();
var server = require('https').createServer(app, credentials);
server.listen(8001);

I don't understand why



via tunoandsuno

No comments:

Post a Comment