Create node server to replace 'make watch'

Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D38
This commit is contained in:
Ben Alpert
2013-07-05 22:55:10 -07:00
parent afb29f5df3
commit 4bc599966f
9 changed files with 70 additions and 6 deletions

29
server.js Normal file
View File

@@ -0,0 +1,29 @@
var path = require("path");
var browserify = require("browserify");
var express = require("express");
var jisonify = require("./jisonify");
var app = express();
app.use(express.logger());
app.get("/MJLite.js", function(req, res) {
var b = browserify();
b.add("./MJLite");
b.transform(jisonify);
var stream = b.bundle({standalone: "MJLite"});
var body = "";
stream.on("data", function(s) { body += s; });
stream.on("end", function() {
res.setHeader("Content-Type", "text/javascript");
res.send(body);
});
});
app.use(express.static(path.join(__dirname, 'static')));
app.listen(7936);
console.log("Serving on http://0.0.0.0:7936/ ...");