feat(weather): /api/weather Open-Meteo proxy with 15-min cache

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-06-02 22:31:48 +10:00
parent eda61a19b2
commit 42a4b5ef33
4 changed files with 67 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import { router as jobsRouter } from './routes/jobs.js';
import { router as captureRouter } from './routes/capture.js';
import { spacesScopedRouter as companionRouter } from './routes/companion.js';
import { router as dashboardRouter } from './routes/dashboard.js';
import { router as weatherRouter } from './routes/weather.js';
export function mountApi(app) {
const api = Router();
@@ -55,6 +56,7 @@ export function mountApi(app) {
api.use('/jobs', jobsRouter);
api.use('/capture', captureRouter);
api.use('/dashboard', dashboardRouter);
api.use('/weather', weatherRouter);
api.use('/:entity_type/:entity_id/tags', tagsByEntityRouter);
api.use((_req, _res, next) => next(new NotFoundError('route not found')));

View File

@@ -0,0 +1,5 @@
import { Router } from 'express';
import { asyncWrap } from '../errors.js';
import * as weather from '../../weather.js';
export const router = Router();
router.get('/', asyncWrap(async (_req, res) => res.json(await weather.current())));