- localization-svc: defaultLocale ru, resolveLocale only by geo - web-svc: DEFAULT_LOCALE ru, layout lang=ru, embeddedTranslations fallback ru - countryToLocale: default ru when no country or unknown country Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
889 B
TypeScript
28 lines
889 B
TypeScript
import express from 'express';
|
|
import cors from 'cors';
|
|
import localeRouter from './routes/locale.js';
|
|
import translationsRouter from './routes/translations.js';
|
|
|
|
const app = express();
|
|
|
|
app.use(cors({ origin: true }));
|
|
const PORT = parseInt(process.env.PORT ?? '3016', 10);
|
|
|
|
app.use(express.json({ limit: '1mb' }));
|
|
|
|
app.use('/api', localeRouter);
|
|
app.use('/api', translationsRouter);
|
|
|
|
app.get('/health', (_, res) =>
|
|
res.json({ status: 'ok', service: 'localization-svc' }),
|
|
);
|
|
app.get('/ready', (_, res) => res.json({ status: 'ready' }));
|
|
|
|
app.listen(PORT, '0.0.0.0', () => {
|
|
console.log(`localization-svc listening on :${PORT}`);
|
|
console.log(` Locale (GET): /api/locale`);
|
|
console.log(` Locale (POST): /api/locale (with client data in body)`);
|
|
console.log(` Translations: /api/translations/:locale`);
|
|
console.log(` Supported locales: /api/locales`);
|
|
});
|