Skip to content
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules/*
.env
to-dos.txt
/seeds/NO_PICTURE.jpg
/seeds/seeds_to_mongoAtlas.json
/seeds/seeds_to_mongoAtlas.json
to fix.bmp
7 changes: 4 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const MongoStore = require('connect-mongo');

const port = process.env.PORT || 3000;
const secret = process.env.SECRET || "TheGemLettuceIsHidden";
// const dbUrl = process.env.DB_URL || "mongodb://localhost:27017/sweetApp";
const dbUrl = "mongodb://localhost:27017/sweetApp";
const dbUrl = process.env.DB_URL || "mongodb://localhost:27017/sweetApp";
// const dbUrl = "mongodb://localhost:27017/sweetApp";
main().catch((err) => {
console.log(
"#####################################MONGO CONNECTION ERROR!##############################################"
Expand Down Expand Up @@ -121,6 +121,7 @@ passport.deserializeUser(User.deserializeUser());
app.use(passport.authenticate("session"));
app.use((req, res, next) => {
if (!(req.originalUrl == '/users/login' || req.originalUrl == '/users/register')) res.clearCookie('returnTo')
console.log('IN THE APP.JS, req.orgUrl: ', req.originalUrl)
res.locals.path = req.originalUrl;
res.locals.success = req.flash("success");
res.locals.error = req.flash("error");
Expand Down Expand Up @@ -170,4 +171,4 @@ app.use((err, req, res, next) => {

app.listen(port, () => {
console.log(`Serving on port ${port}`);
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Dessert rating site. Built with Nodejs, Express, MongoDB",
"main": "app.js",
"scripts": {
"start": "npm app.js",
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand Down
5 changes: 3 additions & 2 deletions views/desserts/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
<div class="container my-5">
<%- include("../partials/flash")%>
<h1 class="text-center">Browse our delicious desserts</h1>
<p class="text-center text-muted">Have a closer look by clicking on the image, and feel the.. Sweet!</p>
<p class="text-center text-muted"> Explore the sweetness of your area with our interactive map, and discover
the best puddings near you on SweetApp's product browsing page!</p>
<div class="row justify-content-evenly text-center">
<%for (let d of data){%>

<div class="card m-3 p-0 hidden hidden-left" id="card-icon">
<a href="/desserts/<%=d._id%>">
<%if(d.imgs&&d.imgs.length){%>
<%if(d.imgs&&d.imgs.length&&d.imgs[0].url!==""){%>
<img src="<%=d.imgs[0].url%>" class="card-img-top" alt="..." >
<%}else{%>
<img src='<%=defaultPic%>' class="card-img-top" alt="..." >
Expand Down
4 changes: 2 additions & 2 deletions views/desserts/show.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>
<%}else{%>
<img
<%if(data.imgs.length){%>
<%if(data.imgs.length&&data.imgs[0].url!==""){%>
src="<%=data.imgs[0].url%>"
id="<%=data.imgs[0].filename%>"
<%}else{%>
Expand Down Expand Up @@ -165,7 +165,7 @@
</div>
<%}%>
</section>
<script defer>
<script >
console.log('be carefull, prettier adds space in EJS tag when files saved!!')
const mapToken = '<%- process.env.MAP_TOKEN %>';
const dessert = <%- JSON.stringify(data) %>;
Expand Down
3 changes: 1 addition & 2 deletions views/home.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<%} %>
</h1>
<h2 class="fs-5 ">
Welcome in our spacious and sweet place. Enjoy browsing best
of puddings that we could find, and if you fancy try it and leave your opinion!
Indulge in the sweetness of pudding perfection with SweetApp - browse, try, and rate the best desserts today!
</a>
</h2>
<a class="mt-3 btn btn-lg btn-outline-dark fw-light" href="/desserts" role="button">Check it out!</a>
Expand Down