Reputation: 1870
Can someone explain in depth what does this line of code mean in NodeJS:
var app = module.exports = express.createServer();
Upvotes: 0
Views: 164
Reputation: 626
It can be rewritten as:
module.exports = express.createServer();
var app = module.exports;
Upvotes: 1
Reputation: 167162
express.createServer();
The above line has the instance of express
and creates a server instance (server handle) and returns the whole export class.
With the above, you are setting both module.exports
as well as app
to do further.
Upvotes: 4