doc: add fetch all data and individual data method
This commit is contained in:
1 parent
421130250e
commit
3994775458
1 file changed
+20
@@ -0,0 +1,20 @@
|
|||||||
|
// 导入models文件
|
||||||
|
import ncovChinaData from "../models/ncovChinaData.js";
|
||||||
|
|
||||||
|
// Fetch China Data method
|
||||||
|
export const fetchAllChinaData = (req, res) => {
|
||||||
|
ncovChinaData.find().then(result => {
|
||||||
|
res.send(result);
|
||||||
|
}).catch(error => {
|
||||||
|
res.status(404).json({ message: error });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fetch individual data method
|
||||||
|
export const fetchIndividualChinaData = (req, res) => {
|
||||||
|
ncovChinaData.findById('626ef3242d047c1843308d5c').then(result => {
|
||||||
|
res.send(result);
|
||||||
|
}).catch(error => {
|
||||||
|
res.status(404).json({message: error});
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in new issue
Block a user