You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/backend/api/locales.ts

41 lines
705 B

import type { FastifyInstance } from 'fastify'
/**
* Locales API Routes
*/
async function routes(app: FastifyInstance) {
app.get(
'/',
{
config: {
publicAccess: true
},
schema: {
summary: 'List all locales',
tags: ['Locales']
}
},
async () => {
return WIKI.models.locales.getLocales()
}
)
app.get<{ Params: { code: string } }>(
'/:code/strings',
{
config: {
publicAccess: true
},
schema: {
summary: 'Get locale strings',
tags: ['Locales']
}
},
async (req) => {
return WIKI.models.locales.getStrings(req.params.code)
}
)
}
export default routes