mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
Create node server to replace 'make watch'
Reviewers: xymostech Reviewed By: xymostech Differential Revision: http://phabricator.benalpert.com/D38
This commit is contained in:
29
server.js
Normal file
29
server.js
Normal 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/ ...");
|
Reference in New Issue
Block a user