Skip to content

Commit a50c410

Browse files
committed
Change binary API
1 parent 8558b94 commit a50c410

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

api.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ module.exports = function(version) {
33
if (version !== 'http' && version !== 'https')
44
throw new Error(version + ' not supported.');
55

6-
var util = require('util'),
7-
http = require(version),
8-
url = require('url'),
9-
api = {};
6+
var util = require('util');
7+
var http = require(version);
8+
var url = require('url');
9+
var api = {};
1010

1111
// API Server inherits EventEmitter
1212
function Server () {
@@ -21,8 +21,8 @@ function Server () {
2121
// Listen for any request and map the request to it's own event.
2222
// 'regularRequest' is emitted, when there are no listeners for the event.
2323
this.addListener('request', function(req, resp) {
24-
var method,
25-
path;
24+
var method;
25+
var path;
2626

2727
req.urlParsed = url.parse(req.url, true, true);
2828
path = req.urlParsed.pathname;
@@ -34,8 +34,8 @@ function Server () {
3434
if (method = this.methods[req.method])
3535
// for each listener of method
3636
for (var listener in method) {
37-
var match,
38-
p = method[listener].pattern;
37+
var match;
38+
var p = method[listener].pattern;
3939

4040
// match it
4141
if ((match = p.exec(req.url)) != null) {

bin/api.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ confdir(process.cwd(), 'conf', function (err, confdir) {
6464

6565
var modConf = JSON.parse(data);
6666

67+
console.log('Starting module '+mod+'.');
6768
// hook module into app
68-
module(app, log, modConf, conf);
69-
console.log('Module '+mod+' up and running.');
69+
module(app, log, modConf, conf, function (err) {
70+
if (err)
71+
return die(err);
72+
73+
console.log('Module '+mod+' up and running.');
74+
});
7075
});
7176
});
7277

0 commit comments

Comments
 (0)