mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-26 22:43:06 -04:00
22 lines
712 B
TypeScript
22 lines
712 B
TypeScript
import { Router } from 'express';
|
|
import { handleErrorAsync } from '../../src/helpers.ts';
|
|
import buildLocaleList from '../../src/buildLocaleList.ts';
|
|
import fs from 'fs';
|
|
|
|
const router = Router();
|
|
|
|
router.get('/versions', handleErrorAsync(async (req, res) => {
|
|
return res.json(buildLocaleList(global.config.locale));
|
|
}));
|
|
|
|
router.get('/locales', handleErrorAsync(async (req, res) => {
|
|
return res.json(buildLocaleList(global.config.locale));
|
|
}));
|
|
|
|
router.get('/version', handleErrorAsync(async (req, res) => {
|
|
const versionFile = `${__dirname}/../../cache/version`;
|
|
return res.json(fs.existsSync(versionFile) ? fs.readFileSync(versionFile).toString('utf-8') : null);
|
|
}));
|
|
|
|
export default router;
|