56
data: xodim,
});
});
app.get("/bemorlar", async (req, res) => {
const bemorlar = await Bemor.find()
.populate([{ path: "doktori" }, { path: "dorilar" }])
.lean();
res.render("bemorlar", { bemorlar: bemorlar });
});
app.post("/bemorlar", async (req, res, next) => {
const bemor = await Bemor.create(req.body);
res.status(200).json({
success: true,
data: bemor,
});
});
app.get("/dorilar", async (req, res) => {
const dorilar = await Dori.find().lean();
res.render("dorilar", { dorilar: dorilar });
});
app.post("/dorilar", async (req, res, next) => {
const dori = await Dori.create(req.body);
res.status(200).json({
success: true,
data: dori,
});
});
app.get("/yetberlar", async (req, res) => {
const yetberlar = await YetBer.find().lean();
res.render("yetberlar", { yetberlar: yetberlar });
});
app.post("/yetberlar", async (req, res, next) => {
const yetber = await YetBer.create(req.body);
res.status(200).json({
success: true,
data: yetber,
});
});
app.listen(5000);