mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-21 09:11:29 +03:00
20 lines
467 B
JavaScript
20 lines
467 B
JavaScript
const asyncWrapper = require('../../middleware/asyncWrapper');
|
|
const Weather = require('../../models/Weather');
|
|
|
|
// @desc Get latest weather status
|
|
// @route GET /api/weather
|
|
// @access Public
|
|
const getWeather = asyncWrapper(async (req, res, next) => {
|
|
const weather = await Weather.findAll({
|
|
order: [['createdAt', 'DESC']],
|
|
limit: 1,
|
|
});
|
|
|
|
res.status(200).json({
|
|
success: true,
|
|
data: weather,
|
|
});
|
|
});
|
|
|
|
module.exports = getWeather;
|