Created
November 10, 2012 04:28
-
-
Save shunya/4049897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var NE = require('nuby-express'); | |
var util = require('util'); | |
var _DEBUG = true; | |
module.exports = function (config, callback) { | |
var frame = new NE.Framework(); | |
NE.log.set_log_file(__dirname + '/logs/nuby_express.log', {reset: true}) | |
frame.start_load(_on_load, __dirname + "/app"); | |
function _on_load() { | |
if (_DEBUG) console.log('framework loaded'); | |
if (config){ | |
if(config.mongoose){ | |
frame.config.mongoose.db = config.mongoose.db; | |
} | |
} | |
frame.start_server(function () { | |
var port = frame.config.server.port; | |
if (config) { | |
if (config.port) { | |
port = config.port; | |
} | |
if(config.mongoose){ | |
frame.config.mongoose.db = config.mongoose.db; | |
} | |
} | |
console.log('listening to port %s', port); | |
frame.server().listen(port); | |
if (callback) { | |
callback(); | |
} | |
}); | |
} | |
return frame; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment