@nzz/q-server
Version:
__Q__ is a system that lets journalists create visual elements for stories. It is developed by [NZZ Storytelling](https://www.nzz.ch/storytelling) and used in the [NZZ](https://www.nzz.ch) newsroom.
30 lines (23 loc) • 691 B
JavaScript
module.exports = {
path: '/editor/tools',
method: 'GET',
config: {
description: 'Returns all available Q tool names',
tags: ['api', 'editor']
},
handler: (request, reply) => {
const tools = request.server.settings.app.tools.get('');
let editorToolConfigs = [];
Object.keys(tools)
.forEach(toolName => {
let toolEditorConfig = {
name: toolName
}
Object.assign(toolEditorConfig, tools[toolName].editor)
// remove label_locales, we do not need these on the client
delete toolEditorConfig.label_locales;
editorToolConfigs.push(toolEditorConfig);
})
reply(editorToolConfigs);
}
}