19 lines
366 B
JavaScript
19 lines
366 B
JavaScript
|
require("dotenv").config();
|
||
|
const router = require('express').Router();
|
||
|
|
||
|
const Averages = require('./dailyAveragesModel');
|
||
|
|
||
|
router.get('/:id/averages', (req, res) => {
|
||
|
|
||
|
Averages.findUserBy(req.params.id)
|
||
|
.first()
|
||
|
.then(response => {
|
||
|
res.status(200).json(response);
|
||
|
})
|
||
|
.catch(error => {
|
||
|
res.status(500).json(error);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
module.exports = router;
|