mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
dd9537cd88
Much less confusing.
26 lines
681 B
JavaScript
26 lines
681 B
JavaScript
// Cook a TiddlyWiki recipe and serve the result over HTTP
|
|
//
|
|
// Usage: node server.js <recipefile>
|
|
|
|
"use strict";
|
|
|
|
var WikiStore = require("./js/WikiStore.js").WikiStore,
|
|
Recipe = require("./js/Recipe.js").Recipe,
|
|
http = require("http"),
|
|
fs = require("fs"),
|
|
url = require("url"),
|
|
path = require("path"),
|
|
util = require("util");
|
|
|
|
var filename = process.argv[2];
|
|
|
|
http.createServer(function(request, response) {
|
|
response.writeHead(200, {"Content-Type": "text/html"});
|
|
var store = new WikiStore(),
|
|
theRecipe = new Recipe(store,filename,function() {
|
|
response.end(theRecipe.cook(), "utf-8");
|
|
});
|
|
}).listen(8000);
|
|
|
|
util.puts("Server running at http://127.0.0.1:8000/");
|