I\'m an amateur learning to build with node.js. I\'ve been following a tutorial to create my first node.js app. It worked perfectly until I entered \'npm start\'. The log is:>
You don't have declared any function called set
inside the app.js
file.
Create that function and export it like this:
exports.set = function(...) { ... };
If this app
is the express app
yo especify a port like this:
var express = require('express'),
http = require('http');
var app = express();
http.createServer(app).listen(port);
instead of
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
This is because the port is a property of the http server and not of the express app
You can use also
var express = require('express'),
app = express();
app.listen(port);