Skip to content

Commit 563f70f

Browse files
committed
[api] Added a webserver that wraps the npm command
1 parent ddbd104 commit 563f70f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"directories" : { "test": "./test"},
2222
"scripts": {
2323
"test": "vows --spec",
24-
"start": "node app.js"
24+
"start": "node server.js"
2525
},
2626
"name": "node-migrator-bot",
2727
"author": "Farrin A. Reid",

server.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var spawn = require('child_process').spawn,
2+
http = require('http'),
3+
path = require('path');
4+
5+
var server = http.createServer(function (req, res) {
6+
res.setHeader(302, { 'Location': 'http://github.com/blakmatrix/node-migrator-bot' });
7+
res.end('Redirecting you to the github page for this project!');
8+
});
9+
10+
// Start the npm running.
11+
var bot = spawn('node', [
12+
path.resolve(__dirname, 'app.js'),
13+
'npm'
14+
]);
15+
16+
bot.stdout.pipe(process.stdout);
17+
bot.stderr.pipe(process.stderr);
18+
19+
server.listen(8080);

0 commit comments

Comments
 (0)