mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-27 12:35:15 +00:00
* Refactor server routes to modules New module type: serverroute Caveats: Loading order is not deterministic but this would only matter if two route modules attempted to use the same path regexp (that would be silly). * Add static assets plugin This plugin allows the node server to fetch static assets in the /assets directory. I felt that this was a feature that goes above the core functionality. That is why I added it as a plugin. with the modular route extensions this was a breeze. * Add serverroute description to ModuleTypes
21 lines
457 B
JavaScript
21 lines
457 B
JavaScript
/*\
|
|
title: $:/core/modules/serverroute/get-index.js
|
|
type: application/javascript
|
|
module-type: serverroute
|
|
|
|
GET /
|
|
|
|
\*/
|
|
(function() {
|
|
module.exports = {
|
|
method: "GET",
|
|
path: /^\/$/,
|
|
|
|
handler: function(request,response,state) {
|
|
response.writeHead(200, {"Content-Type": state.server.get("serveType")});
|
|
var text = state.wiki.renderTiddler(state.server.get("renderType"),state.server.get("rootTiddler"));
|
|
response.end(text,"utf8");
|
|
}
|
|
};
|
|
}());
|