mirror of
https://github.com/franjsco/umbrello-api
synced 2025-02-16 11:40:46 +01:00
Add /search route
This commit is contained in:
parent
9a97909e74
commit
d6925adcac
@ -1,5 +1,5 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { getCurrentWeatherById, getForecastWeatherById } from './apiOWM';
|
import { getCurrentWeatherById, getForecastWeatherById, getCityIdByName } from './api';
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
@ -33,4 +33,10 @@ router.get('/forecast', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
router.get('/search', (req, res) => {
|
||||||
|
getCityIdByName(req.query.city)
|
||||||
|
.then((obj) => res.json(obj))
|
||||||
|
.catch((err) => res.status(500).send(err));
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user