UNPKG

cnpmjs.org

Version:

Private npm registry and web for Enterprise, base on MySQL and Simple Store Service

43 lines (36 loc) 1.09 kB
/**! * cnpmjs.org - worker.js * * Copyright(c) cnpmjs.org and other contributors. * MIT Licensed * * Authors: * dead_horse <dead_horse@qq.com> * fengmk2 <fengmk2@gmail.com> (http://fengmk2.github.com) */ 'use strict'; /** * Module dependencies. */ var graceful = require('graceful'); var logger = require('./common/logger'); var config = require('./config'); var registry = require('./servers/registry'); var web = require('./servers/web'); registry.listen(config.registryPort, config.bindingHost); web.listen(config.webPort, config.bindingHost); console.log('[%s] [worker:%d] Server started, registry server listen at %s:%d, web listen at %s:%d, cluster: %s', new Date(), process.pid, config.bindingHost, config.registryPort, config.bindingHost, config.webPort, config.enableCluster); graceful({ server: [registry, web], error: function (err, throwErrorCount) { if (err.message) { err.message += ' (uncaughtException throw ' + throwErrorCount + ' times on pid:' + process.pid + ')'; } console.error(err.stack); logger.error(err); } });