UNPKG

1.04 kBtext/coffeescriptView Raw
1_express = require 'express'
2_app = _express()
3_server = require('http').createServer _app
4_silky = require './index'
5_initialize = require '../lib/initialize'
6
7options =
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