feat: add menus (repas)

This commit is contained in:
Nathan Lamy 2025-08-24 00:41:12 +02:00
parent 629f24811a
commit 1f8206ec88
3 changed files with 14 additions and 0 deletions

View file

@ -26,6 +26,8 @@ services:
depends_on:
- redis
- postgres
volumes:
- /home/nathan/khollise/menu/menus.json:/home/node/menus.json:ro
# Link env file
env_file:
- ./prod.env

View file

@ -73,4 +73,6 @@ export default await Env.create(new URL('../', import.meta.url), {
VAPID_PRIVATE_KEY: Env.schema.string(),
API_BEARER_TOKEN: Env.schema.string(),
MENUS_PATH: Env.schema.string(),
})

View file

@ -74,3 +74,13 @@ router
router.get('/health', async () => {
return { status: 'ok' }
})
// BETA: Serve menus.json file
import fs from 'node:fs/promises'
import env from './env.js'
router.get('/menus', async () => {
// Return menus.json file
const data = await fs.readFile(env.get('MENUS_PATH'), 'utf-8')
return JSON.parse(data)
})