Automatically start a development server

This avoids one of the few requirements we have left: you no longer have to
start a KaTeX development server, the script will do it for you, using a
random port number.

To reproduce the old behaviour, explicitely state --katex-port=7936.
This commit is contained in:
Martin von Gagern
2015-07-15 00:46:38 +02:00
parent a18db36296
commit 9752d02748
3 changed files with 74 additions and 18 deletions

View File

@@ -7,7 +7,9 @@ var less = require("less");
var app = express();
app.use(express.logger());
if (require.main === module) {
app.use(express.logger());
}
var serveBrowserified = function(file, standaloneName) {
return function(req, res, next) {
@@ -69,5 +71,9 @@ app.use(function(err, req, res, next) {
res.send(500, err.stack);
});
app.listen(7936);
console.log("Serving on http://0.0.0.0:7936/ ...");
if (require.main === module) {
app.listen(7936);
console.log("Serving on http://0.0.0.0:7936/ ...");
}
module.exports = app;