doc: add fetch all data and individual data method

This commit is contained in:
Leon Xu committed 2022-05-01 16:31:56 -07:00
1 parent 421130250e
commit 3994775458
1 file changed
+20
+20
View File
@@ -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});
})
}