I use the TiddlyWiki browser extension to save articles to TiddlyWiki. I would like the plugin to fetch all the tags of the current user’s wiki to make it easier to select, instead of the user manually entering tags. Therefore, I think adding an additional route would be a suitable solution. What do you think about this? @jeremyruston
/*\
title: $:/core/modules/server/routes/get-tags-json.js
type: application/javascript
module-type: route
\*/
(function () {
/*jslint node: true, browser: true */
/*global $tw: false */
'use strict';
var DEFAULT_FILTER = '[tags[]]';
exports.method = 'GET';
exports.path = /^\/recipes\/default\/tags.json$/;
exports.handler = function (request, response, state) {
var filter = state.queryParameters.filter || DEFAULT_FILTER;
const tags = state.wiki.filterTiddlers(filter);
var text = JSON.stringify(tags);
state.sendResponse(
200,
{ 'Content-Type': 'application/json' },
text,
'utf8',
);
};
})();