1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-29 21:45:16 +00:00
Files
TiddlyWiki5/core/modules/serverroute/get-favicon.js
Devin Weaver 1ae3927c28 Module-ize server routes and add static file support (#2510)
* 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
2016-08-08 14:11:47 +01:00

21 lines
430 B
JavaScript

/*\
title: $:/core/modules/serverroute/get-favicon.js
type: application/javascript
module-type: serverroute
GET /favicon.ico
\*/
(function() {
module.exports = {
method: "GET",
path: /^\/favicon.ico$/,
handler: function(request,response,state) {
response.writeHead(200, {"Content-Type": "image/x-icon"});
var buffer = state.wiki.getTiddlerText("$:/favicon.ico","");
response.end(buffer,"base64");
}
};
}());