Skip to content

Commit

Permalink
curriculum
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Jun 12, 2024
1 parent 9136808 commit 1682fa7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,20 @@ app.get(
"/:locale/curriculum/index.json",
],
async (req, res) => {
const { slug = "" } = req.params;
const data = await findCurriculumPageBySlug(slug);
if (!data) {
return res.status(404).send("Nothing here 🤷‍♂️");
const { locale, slug = "" } = req.params;
if (process.env.RARI) {
console.log(`http://localhost:8083/${locale}/curriculum/${slug}${slug ? "/" : ""}`);
const data = await (
await fetch(`http://localhost:8083/${locale}/curriculum/${slug}${slug ? "/" : ""}`)
).json();
return res.json(data);
} else {
const data = await findCurriculumPageBySlug(slug);
if (!data) {
return res.status(404).send("Nothing here 🤷‍♂️");
}
return res.json(data);
}
return res.json(data);
}
);

Expand Down

0 comments on commit 1682fa7

Please sign in to comment.