17 lines
339 B
JavaScript
17 lines
339 B
JavaScript
const { getRealEstateById } = require("../helpers/db/realEstate");
|
|
|
|
const redirect = async (req, res) => {
|
|
const id = req.params["id"];
|
|
const marketAlert = await getRealEstateById(id);
|
|
if (marketAlert) {
|
|
res.redirect(marketAlert.url);
|
|
} else {
|
|
res.send("Not found");
|
|
res.end();
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
redirect
|
|
};
|