2015-02-06 23:45:28 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-01-30 01:10:49 +00:00
|
|
|
var Activity = require('./src/Activity');
|
2015-02-06 23:45:28 +00:00
|
|
|
var Server = require('./src/Server');
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-02-06 23:45:28 +00:00
|
|
|
exports.middleware = function(options) {
|
|
|
|
var server = new Server(options);
|
|
|
|
return server.processRequest.bind(server);
|
2015-01-30 01:10:49 +00:00
|
|
|
};
|
|
|
|
|
2015-02-06 23:45:28 +00:00
|
|
|
exports.buildPackageFromUrl = function(options, reqUrl) {
|
|
|
|
Activity.disable();
|
|
|
|
var server = new Server(options);
|
|
|
|
return server.buildPackageFromUrl(reqUrl)
|
|
|
|
.then(function(p) {
|
|
|
|
server.kill();
|
|
|
|
return p;
|
|
|
|
});
|
2015-01-30 01:10:49 +00:00
|
|
|
};
|