Skip to content

Working on signup.ejs layout #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.vscode/*
node_modules
.vscode/*
**/.env
79 changes: 35 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
# Introduction

A Simple ToDo App is built using the MVC Architecture, we have also implemented "authorization" so folx can sign up, customize & personalize the app

---

> Be sure to add that lovely star 😀 and fork it for your own copy

---

# Objectives

- It's a beginner level app created to understand how MVC concept and logins are added

---

# Who is this for?

- It's for beginners & intermediates with little more experience, to help understand the various aspects of building a node app with some complex features

---

# Packages/Dependencies used

bcrypt, connect-mongo, dotenv, ejs, express, express-flash, express-session, mongodb, mongoose, morgan, nodemon, passport, passport-local, validator

---

# Install all the dependencies or node packages used for development via Terminal

`npm install`

---

# Things to add

- Create a `.env` file and add the following as `key: value`
- PORT: 2121 (can be any port example: 3000)
- DB_STRING: `your database URI`
---

Have fun testing and improving it! 😎


# Recipe Books

A simple recipe app built using the MVC Architecture, we have also implemented "authorization" so folx can sign up, customize & personalize the app
---

[Link to project](#)

![Anime-Gen](https://github.com/specialyas/recipebooks/blob/main/story.png?raw=true)
---

# Who is this for?

- It's for people who are looking for a place to store their recipes or just view recipes stored by others.

---
# How it's Made

**Tech used:** HTML, CSS, JavaScript, Express, Node and MongoDB


---

# Optimizations
The app can be optimized by adding a sub category to allow for grouping of recipes.

# Development Setup
1. Clone repo to your machine
2. Run `npm install` in terminal to install all project dependencies
3. Create a .env file in the config folder with the following info:
```
PORT = 3000
DB_STRING = database string here
```
4. Type ```npm run start``` in terminal and press enter
5. Visit ```http://localhost:3000``` in your browser
2 changes: 0 additions & 2 deletions config/.env

This file was deleted.

43 changes: 43 additions & 0 deletions controllers/recipes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// const Recipe = require('../models/Recipe');

module.exports = {
getRecipes: async (req, res) => {
console.log(req.user);
try {
const myRecipes = await Recipe.find({ userId: req.user.id });
res.render('myrecipes.ejs', { recipes: myRecipes, user: req.user });
} catch (err) {
console.log(err);
}
},
getOneRecipe: async (req, res) => {
try {
const oneRecipe = await Recipe.findById(req.params.id);
res.render('onerecipe.ejs', { recipe: oneRecipe });
} catch (err) {
console.log(err);
}
},
getAddRecipe: async (req, res) => {
console.log(req.user);
try {
res.render('addrecipe.ejs');
} catch (err) {
console.log(err);
}
},
postAddRecipe: async (req, res) => {
try {
await Recipe.create({
userId: req.user.id,
recipeName: req.body.recipeName,
ingredients: req.body.ingredients,
instructions: req.body.instructions,
});
console.log('Recipe has been added!');
res.redirect('/recipes');
} catch (err) {
console.log(err);
}
},
};
55 changes: 0 additions & 55 deletions controllers/todos.js

This file was deleted.

10 changes: 10 additions & 0 deletions models/Recipe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const mongoose = require('mongoose');

const RecipeSchema = new mongoose.Schema({
userId: { type: String, required: true },
recipeName: { type: String, required: true },
ingredients: { type: Array, required: true },
instructions: { type: String, required: true },
});

module.exports = mongoose.model('Recipe', RecipeSchema);
18 changes: 0 additions & 18 deletions models/Todo.js

This file was deleted.

Loading