javascript - Coffeescript: How to import express module in one line -
currently, have write
app = require 'express' app()
to equivalent javascript:
var app; app = require('express'); app();
how can in 1 line?
i want clear thing here.
first of all, here common way import express module , create application:
express = require 'express' app = express()
app
variable here holds freshly created express application, while express
variable holds framework itself.
now, let's don't need express framework here, application. in case write:
app = require 'express'
and if don't need variable holding application, write that:
do express = require 'express'
though can't imagine why want it. of course, chain everything:
do express = require 'express' .use(express.static('public')) .listen(3000)
but me looks mess.
Comments
Post a Comment