Skip to content

Instantly share code, notes, and snippets.

View Arlen22's full-sized avatar

Arlen22

View GitHub Profile
@Arlen22
Arlen22 / Hosting multiple tiddlywikis on Express.md
Last active May 21, 2021 13:08 — forked from anonymous/index.js
A file to allow running multiple TiddlyWikis as seperate folders of an Express JS application. Made with 5.1.9. Amended for 5.1.14-Prerelease. My part is released into the Public Domain.
  • Download the NodeJS version of TiddlyWiki from GitHub or NPM. If you use NPM, do not use the global option (-g).
  • Put web.js beside tiddlywiki.js.
  • Require web.js from the Express application and call it on every matching request (see below).
  • For TiddlyWiki before 5.1.14-Prerelease: In core/modules/commands/server.js, seperate out the requestHandler function that is passed to http.createServer so it is on the SimpleServer prototype. Add the self variable to the first line of the requestHandler as shown.
SimpleServer.prototype.listen = function(port,host) {
	http.createServer(this.requestHandler.bind(this)).listen(port,host);
};
SimpleServer.prototype.requestHandler = function(request,response) {