jessicalhansen / Quarantine-Cookbook

First group project assigned to develop a CRUD application using REST routing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cass and Jess’ Quarantine Cookbook

Scope:

To build an application where users can store their favorite recipes, in addition to editing and deleting stored recipes.

User story:

Users will be met with a landing page prompting for USERNAME and PASSWORD login information with a button to log in, as well as a button to signup.

New users who need to create an account will be directed to a signup page prompting for a USERNAME, EMAIL, and PASSWORD fields to create an account. Once an account has been created, the user will be redirected to the landing page to log in.

The user will then be directed to a profile page where they can add a recipe, and view all saved recipes. Users can also log out on this page.

Clicking on a recipe will redirect the user to a page showing information for the saved recipe, as well as buttons to edit or delete the individual recipe.

Milestones:

https://trello.com/b/miWL3jVt/recipe-application

    Sprint 1 -
  • Users can see a basic page with a static header and footer.
  • Users can see a landing page.
  • Users can log-in or sign-up.
  • Users can see their profile page.
    Sprint 2 -
  • Users can add a recipe and add a sorting type.
  • Users can select a sorting type.
  • Users can see all available recipes page.
  • Users can select individual recipes.
    Sprint 3 -
  • Users can see individual recipes.
  • Within the recipe page:
  • Users can delete the recipe.
  • Users can edit the recipe.
    Sprint 4 -
  • Users can see styled views on pages.
  • Stretch goal: Users can add and select a sorting type, such as 'vegetarian' or 'meat'.
  • Stretch goal: add recipe difficulty level.
  • Stretch goal: sort recipes by type && difficulty.

Wireframe/ERD:

image_2021-01-15_12-55-55

Database Models:

image_2021-01-15_12-55-55

Technologies Used:

  • HTML
  • CSS
  • Node.js
  • Express
  • EJS
  • MongoDB
  • Mongoose

Code Snips:

router.post('/:userId/recipes', (req, res) => {

    const context = {
        recipeTitle: req.body.recipeTitle,
        ingredients: req.body.ingredients,
        instructions: req.body.instructions,
        recipeType: req.body.recipeType,
        user: req.params.userId,
    }
    console.log(req.params.userId);
    db.Recipe.create(context, (err, newRecipe) => {
        if (err) {
            console.log(err);
        }

        db.User.findById(req.params.userId, (err, foundUser) => {
            if (err) {
                console.log(err);
            }
            
            foundUser.recipes.push(newRecipe
            );

            foundUser.save((err, savedUser) => {
                if (err) {
                    console.log(err);
                }

                res.redirect(`/users/${savedUser._id}`);
            });
        });
    });
}); 

About

First group project assigned to develop a CRUD application using REST routing.


Languages

Language:HTML 56.5%Language:JavaScript 29.3%Language:CSS 14.2%