1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-22 02:04:51 +00:00
Files
TiddlyWiki5/core/modules/serverroute/get-status.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

27 lines
516 B
JavaScript

/*\
title: $:/core/modules/serverroute/get-status.js
type: application/javascript
module-type: serverroute
GET /status
\*/
(function() {
module.exports = {
method: "GET",
path: /^\/status$/,
handler: function(request,response,state) {
response.writeHead(200, {"Content-Type": "application/json"});
var text = JSON.stringify({
username: state.server.get("username"),
space: {
recipe: "default"
},
tiddlywiki_version: $tw.version
});
response.end(text,"utf8");
}
};
}());