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:
@@ -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')));
|
||||
|
||||
5
lib/api/routes/weather.js
Normal file
5
lib/api/routes/weather.js
Normal 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())));
|
||||
Reference in New Issue
Block a user