-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
260 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
node_modules | ||
.env | ||
.vscode | ||
views | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const mongoose = require("mongoose"); | ||
|
||
const CommentSchema = new mongoose.Schema({ | ||
comment: { | ||
type: String, | ||
required: true, | ||
}, | ||
likes: { | ||
type: Number, | ||
required: true, | ||
}, | ||
user: { | ||
type: mongoose.Schema.Types.ObjectId, | ||
ref: "User", | ||
}, | ||
createdAt: { | ||
type: Date, | ||
default: Date.now, | ||
}, | ||
post: { | ||
type: mongoose.Schema.Types.ObjectId, | ||
ref: "Post", | ||
}, | ||
}); | ||
|
||
module.exports = mongoose.model("Comment", CommentSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<%- include('partials/header') -%> | ||
<div class="container"> | ||
<div class="row justify-content-center mt-5"> | ||
<ul class="row list-unstyled"> | ||
<% for(var i=0; i<posts.length; i++) {%> | ||
<li class="col-6 justify-content-between mt-5"> | ||
<a href="/post/<%= posts[i]._id%>"> | ||
<img class="img-fluid" src="<%= posts[i].image%>"> | ||
</a> | ||
</li> | ||
<% } %> | ||
</ul> | ||
</div> | ||
</div> | ||
<%- include('partials/footer') -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<%- include('partials/header') -%> | ||
|
||
<main class="container"> | ||
<div class="row justify-content-around mt-5"> | ||
<a href="/login" class="col-3 btn btn-primary"> Login</a> | ||
<a href="/signup" class="col-3 btn btn-primary"> Signup</a> | ||
</div> | ||
</main> | ||
|
||
|
||
<%- include('partials/footer') -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<%- include('partials/header') -%> | ||
|
||
<main class="container"> | ||
<div class="row justify-content-center"> | ||
<section class="col-6 mt-5"> | ||
<% if (locals.messages.errors) { %> <% messages.errors.forEach( el => { %> | ||
<div class="alert alert-danger"><%= el.msg %></div> | ||
<% }) %> <% } %> <% if (locals.messages.info) { %> <% | ||
messages.info.forEach( el => { %> | ||
<div class="alert alert-info"><%= el.msg %></div> | ||
<% }) %> <% } %> | ||
<form action="/login" method="POST"> | ||
<div class="mb-3"> | ||
<label for="exampleInputEmail1" class="form-label" | ||
>Email address</label | ||
> | ||
<input | ||
type="email" | ||
class="form-control" | ||
id="exampleInputEmail1" | ||
aria-describedby="emailHelp" | ||
name="email" | ||
/> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="exampleInputPassword1" class="form-label">Password</label> | ||
<input | ||
type="password" | ||
class="form-control" | ||
id="exampleInputPassword1" | ||
name="password" | ||
/> | ||
</div> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</form> | ||
</section> | ||
</div> | ||
</main> | ||
|
||
<%- include('partials/footer') -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Baking Mice Unite!</title> | ||
<link | ||
rel="icon" | ||
type="image/png" | ||
sizes="32x32" | ||
href="/imgs/favicon-32x32.png" | ||
/> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" | ||
crossorigin="anonymous" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" | ||
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" | ||
crossorigin="anonymous" | ||
/> | ||
<link rel="stylesheet" href="/css/style.css" /> | ||
</head> | ||
<body> | ||
<header class="container"> | ||
<div class="text-center"> | ||
<h1 class=""><a href="/profile">Baking Mice Unite!</a></h1> | ||
<span>Your Online Recipe Book!</span> | ||
</div> | ||
</header> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<%- include('partials/header') -%> | ||
<div class="container"> | ||
<div class="row justify-content-center mt-5"> | ||
<div class="col-6"> | ||
<h2><%= post.title %></h2> | ||
<img class="img-fluid" src="<%= post.image%>" /> | ||
<div class="row justify-content-between"> | ||
<form | ||
class="col-1" | ||
action="/post/likePost/<%= post.id %>?_method=PUT" | ||
method="POST" | ||
> | ||
<button class="btn btn-primary fa fa-heart" type="submit"></button> | ||
</form> | ||
<h3 class="col-3">Likes: <%= post.likes %></h3> | ||
<%if(post.user == user.id){ %> | ||
<form | ||
action="/post/deletePost/<%= post.id %>?_method=DELETE" | ||
method="POST" | ||
class="col-3" | ||
> | ||
<button class="btn btn-primary fa fa-trash" type="submit"></button> | ||
</form> | ||
<%}%> | ||
</div> | ||
</div> | ||
<div class="col-3 mt-5"> | ||
<p><%= post.caption %></p> | ||
</div> | ||
<div class="col-6 mt-5"> | ||
<a class="btn btn-primary" href="/profile">Return to Profile</a> | ||
<a class="btn btn-primary" href="/feed">Return to Feed</a> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<%- include('partials/footer') -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<%- include('partials/header') -%> | ||
<div class="container"> | ||
<div class="row mt-5"> | ||
<div class="col-6"> | ||
<div> | ||
<p><strong>User Name</strong>: <%= user.userName %></p> | ||
<p><strong>Email</strong>: <%= user.email %></p> | ||
<a href="/logout" class="col-3 btn btn-primary">Logout</a> | ||
</div> | ||
<div class="mt-5"> | ||
<h2>Add a recipe</h2> | ||
<form action="/post/createPost" enctype="multipart/form-data" method="POST"> | ||
<div class="mb-3"> | ||
<label for="title" class="form-label">Recipe name</label> | ||
<input type="text" class="form-control" id="recipename" name="recipename"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="procedure" class="form-label">Procedure</label> | ||
<textarea class="form-control" id="procedure" name="procedure"></textarea> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="imgUpload" class="form-label">Image</label> | ||
<input type="file" class="form-control" id="imageUpload" name="file"> | ||
</div> | ||
<button type="submit" class="btn btn-primary" value="Upload">Submit</button> | ||
</form> | ||
</div> | ||
</div> | ||
<div class="col-6"> | ||
<ul class="row list-unstyled"> | ||
<% for(var i=0; i<posts.length; i++) {%> | ||
<li class="col-6 justify-content-between mt-5"> | ||
<a href="/post/<%= posts[i]._id%>"> | ||
<img class="img-fluid" src="<%= posts[i].image%>"> | ||
</a> | ||
</li> | ||
<% } %> | ||
</ul> | ||
<div class="row justify-content-center mt-5"> | ||
<a class="btn btn-primary" href="/feed">Return to Feed</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<%- include('partials/footer') -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<%- include('partials/header') -%> | ||
<main class="container"> | ||
<div class="row justify-content-center"> | ||
<section class="col-6 mt-5"> | ||
<% if (locals.messages.errors) { %> | ||
<% messages.errors.forEach( el => { %> | ||
<div class="alert alert-danger"><%= el.msg %></div> | ||
<% }) %> | ||
<% } %> | ||
<% if (locals.messages.info) { %> | ||
<% messages.info.forEach( el => { %> | ||
<div class="alert alert-info"><%= el.msg %></div> | ||
<% }) %> | ||
<% } %> | ||
<form action="/signup" method="POST"> | ||
<div class="mb-3"> | ||
<label for="userName" class="form-label">User Name</label> | ||
<input type="text" class="form-control" id="userName" name="userName"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="exampleInputEmail1" class="form-label">Email address</label> | ||
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="email"> | ||
<div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="password" class="form-label">Password</label> | ||
<input type="password" class="form-control" id="password" name="password"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="confirmPassword" class="form-label">Confirm Password</label> | ||
<input type="password" class="form-control" id="confirmPassword" name="confirmPassword"> | ||
</div> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</form> | ||
</section> | ||
</div> | ||
</main> | ||
|
||
<%- include('partials/footer') -%> |