mp/Web-Server/routes/getLocationId.js
newtbot 233ebafdcb location route
NO validation
no middleware to auth
2023-12-30 03:59:04 +08:00

20 lines
577 B
JavaScript

const { sequelize } = require("../../Database/mySql.js");
const { locatioModel } = require("../../Database/model/locationModel.js");
const { getLocationById } = require("../functions/APIDatabase.js");
const express = require('express');
const router = express.Router();
router.get('/:id', async (req, res) => {
try {
//get params
const { id } = req.params;
const location = await getLocationById(id);
res.json(location);
} catch (error) {
console.error(error);
}
});
// Export the router
module.exports = router;