feat(Countries): Adding countries endpoint

This commit is contained in:
2023-10-05 15:59:22 -06:00
parent 55f1c6e091
commit 83e037c298
34 changed files with 669 additions and 47 deletions

View File

@@ -0,0 +1,17 @@
"use strict";
const { ROOT_PATH, LIB_PATH, MODELS_PATH, HANDLERS_PATH } = process.env;
const { getPagination , queryPage } = require( `${ROOT_PATH}/${LIB_PATH}/Misc.js` );
const countriesModel = require( `${ROOT_PATH}/${MODELS_PATH}/countries.model.js` );
const getCountriesList = async(req, res) => {
const { page , elements } = getPagination( req.query );
const retVal = await queryPage( page , elements, countriesModel );
res.send( retVal );
};
const getCountry = async(req, res) => {
const retVal = await countriesModel.findById( req.params.id );
res.send( retVal );
};
module.exports = { getCountriesList , getCountry };