Clone
15
Home
theis.gaedigk edited this page 2025-06-14 15:50:18 +02:00

Welcome to the Cookbook-Wiki.

You've reached the wiki for my Cookbook app!

Help site

On this site you can find tutorials and other stuff that can help you.

How to start the app?

This can be done in five simple steps:

  1. Download the .zip file and unpack it.
  2. Then go to the backend direcory. image
  3. There simply double click on the Cookbook-v1_0.exe executable file to start the program. image
  4. A new terminal window with a link should pop up. Then click on this link. It should be http://localhost:3000 like shown on the image: image
  5. A new Browser tab should pop up with the cookbook interface which look like this: image

Done!

How to create recipes?

If you want to create a recipe, simply click on create recipe image

Then this window should pop up image

In this window, you can type everything you want!

How to delete recipes?

Currently there exists no way to delete recipes via an UI.

But you can delete recipes by deleting the recipe file. These files can you find in the recipes directory. To go in that directory you must open the Cookbook folder then go through these directorys: backend --> database --> recipes or /backend/database/recipes.

In this directory you can find all of the recipes that you have created. They are all stored in .txt files.

How to load recipes?

To load recipes, simply click on image

How to edit recipes?

Unfortunatly, there is no UI for editing recipies yet.

But you can edit your recipes, by going in to the recipes directory. To go in that directory you must open the Cookbook folder then go through these directorys: backend --> database --> recipes or /backend/database/recipes.

There you will find all of your recipes stored in different .txt files. The title of your recipe will always be the filename of the .txt file. The content of your recipes is of course in the .txt file.

For instance, here is the model to load the recipes.

Extract from server.js (there is more code below and before):

app.get("/", (req, res) => {
  // sync recipes
  const recipesFolder = path.join(basePath, "database", "recipes");

  if (!fs.existsSync(recipesFolder)) {
    fs.mkdirSync(recipesFolder, { recursive: true });
  }

  fs.readdir(recipesFolder, (err, files) => {
    if (err) {
      return res.status(500).send("Error by reading recipe files!");
    }

    const txtFiles = files.filter((file) => file.endsWith(".txt"));

    const recipes = txtFiles.map((file) => {
      const content = fs.readFileSync(path.join(recipesFolder, file), "utf8");
      return {
        title: path.basename(file, ".txt"),
        content: marked.parse(content),
      };
    });

    res.render("index", { recipes });
  });
});