1 | _express = require 'express'
|
2 | _app = _express()
|
3 | _server = require('http').createServer _app
|
4 | _silky = require './index'
|
5 | _initialize = require '../lib/initialize'
|
6 |
|
7 | options =
|
8 | workbench: process.env.WORKBENCH || global.SILKY?.WORKBENCH
|
9 | env: process.env.NODE_ENV || global.SILKY?.NODE_ENV
|
10 | language: process.env.LANG || global.SILKY?.LANG
|
11 | port: process.env.PORT || global.SILKY?.PORT
|
12 | debug: process.env.DEBUG || global.SILKY?.DEBUG
|
13 |
|
14 | _initialize(options)
|
15 | _silky(_app, _server)
|
16 |
|
17 | #_app.set 'port', _utils.options.port || _utils.config.port || 14422
|
18 | #
|
19 | #_server.on 'error', (err) ->
|
20 | # if err.code is 'EADDRINUSE'
|
21 | # console.log "端口冲突,请使用其它端口".red
|
22 | # return process.exit(1)
|
23 | #
|
24 | # console.log "Silky发生严重错误".red
|
25 | # console.log err.message.red
|
26 | #
|
27 | #_server.listen _app.get('port')
|
28 | #
|
29 | #console.log "Port -> #{_app.get('port')}"
|
30 | #console.log "Workbench -> #{_utils.options.workbench}"
|
31 | #console.log "Environment -> #{_utils.options.env}"
|
32 | #console.log "Please visit http://localhost:#{_app.get('port')}" |
\ | No newline at end of file |