fix(server): configuration page

This commit is contained in:
Artemy 2024-05-15 16:12:48 +03:00
parent d477de027a
commit 8be52a0237
3 changed files with 11 additions and 2 deletions

View File

@ -1,8 +1,8 @@
import { Middleware, JSX } from '@txtdot/sdk'; import { Middleware, JSX } from '@txtdot/sdk';
const Highlight = new Middleware( const Highlight = new Middleware(
'highlight', 'Highlight',
'Highlights code with highlight.js', 'Highlights code with highlight.js only when needed',
['*'] ['*']
); );

View File

@ -9,6 +9,7 @@ export default async function configurationRoute(fastify: FastifyInstance) {
fastify.get('/configuration', { schema: indexSchema }, async (_, reply) => { fastify.get('/configuration', { schema: indexSchema }, async (_, reply) => {
return reply.view('/templates/configuration.ejs', { return reply.view('/templates/configuration.ejs', {
engines: distributor.engines_fallback, engines: distributor.engines_fallback,
middlewares: distributor.middles_fallback,
config, config,
}); });
}); });

View File

@ -42,6 +42,14 @@
} }
%> %>
</ol> </ol>
<h2>Available middlewares</h2>
<ol>
<%
for (const middleware of middlewares) {
%><li><%= middleware.name %>: <%= middleware.description %></li><%
}
%>
</ol>
<h2>Available routes</h2> <h2>Available routes</h2>
<% <%
for (const route of config.dyn.routes) { for (const route of config.dyn.routes) {