finished frontend

This commit is contained in:
2025-06-09 22:54:45 +02:00
parent 08477e6e1b
commit 6f06b0869e
4 changed files with 18 additions and 16 deletions

14
backend/routes/recipes.js Normal file
View File

@@ -0,0 +1,14 @@
const express = require("express");
const router = express.Router();
router.get("/", (req, res) => {
res.send("Enter a recipe name in the url!");
});
router.get("/:id", (req, res) => {
res.sendFile(
`/Gitea_Dus1_REPOS/Cookbook/backend/database/recipes/${req.params.id}.json`
);
});
module.exports = router;

View File

@@ -1,12 +0,0 @@
const express = require('express')
const router = express.Router()
router.get("/", (req, res) => {
res.send("User List")
})
router.get("/new", (req, res) => {
res.send("User New Form")
})
module.exports = router

View File

@@ -11,8 +11,8 @@ app.get("/add", (req, res) => {
res.render("addRecipe/index");
});
const userRouter = require("./routes/users");
const recipeRouter = require("./routes/recipes");
app.use("/users", userRouter);
app.use("/recipe", recipeRouter);
app.listen(3000);

View File

@@ -14,11 +14,11 @@
<h1>Cookbook</h1>
<div class="button-group">
<button onclick="syncRecipes()">🔄 Sync Recipes</button>
<a href="addRecipe/addRecipe.html" class="secondary-button"
<a href="/add" class="secondary-button"
> Add Recipe</a
>
<a
href="https://example.com/help"
href="https://git.the1s.de/theis.gaedigk/Cookbook/src/branch/main/helpSite.md"
class="secondary-button"
target="_blank"
rel="noopener noreferrer"