From 03e8b7e5aad382a7d5e48ed66efefaafb6393d89 Mon Sep 17 00:00:00 2001 From: wojciech krupa Date: Tue, 13 Dec 2022 22:04:54 +0000 Subject: [PATCH 1/7] deploy try --- app.js | 17 ++++++++++------- package.json | 5 +++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app.js b/app.js index 67b60e6..99c4c6a 100644 --- a/app.js +++ b/app.js @@ -3,7 +3,7 @@ if (process.env.NODE_ENV !== "production") { } console.log('key ', process.env.CLOUDINARY_KEY) console.log('cloudname ', process.env.CLOUDINARY_CLOUD_NAME) -console.log('secret ', process.env.CLOUDINARY_SECRET) +console.log('cloudinary secret ', process.env.CLOUDINARY_SECRET) const express = require("express"); const app = express(); @@ -26,8 +26,10 @@ const LocalStrategy = require("passport-local"); const MongoStore = require('connect-mongo'); -// const dbUrl = process.env.DB_URL; -const dbUrl = "mongodb://localhost:27017/sweetApp"; +const post = 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"; main().catch((err) => { console.log( "#####################################MONGO CONNECTION ERROR!##############################################" @@ -86,7 +88,7 @@ app.use(methodOverride("_method")); const store = MongoStore.create({ mongoUrl: dbUrl, - secret: 'TheGemLettuceIsHidden', + secret, touchAfter: 24 * 3600 // time period in seconds }) @@ -97,7 +99,7 @@ store.on("error", function (e) { const sessionConfig = { store, name: 'sweetsession', - secret: "TheGemLettuceIsHidden", + secret, resave: false, saveUninitialized: true, cookie: { @@ -167,6 +169,7 @@ app.use((err, req, res, next) => { .render("./error", { title: "ERROR", statusCode, message, err }); }); -app.listen(3000, () => { - console.log("LISTEN ON PORT 3000"); + +app.listen(port, () => { + console.log(`Serving on port ${port}`); }); diff --git a/package.json b/package.json index 4cb2bc0..4b4df0b 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,9 @@ "name": "sweetapp", "version": "1.0.0", "description": "Dessert rating site. Built with Nodejs, Express, MongoDB", - "main": "index.js", + "main": "app.js", "scripts": { + "start": "npm app.js", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { @@ -40,4 +41,4 @@ "passport-local-mongoose": "^7.1.2", "sanitize-html": "^2.7.3" } -} +} \ No newline at end of file From 22681a0b744a8176eb1d9df535b1523e408ee387 Mon Sep 17 00:00:00 2001 From: wojciech krupa Date: Tue, 13 Dec 2022 22:22:14 +0000 Subject: [PATCH 2/7] deploy try - start var changed --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b4df0b..95f3023 100644 --- a/package.json +++ b/package.json @@ -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": { From 11799d4a2c60651db4285cbe040891ce505c057b Mon Sep 17 00:00:00 2001 From: wojciech krupa Date: Tue, 13 Dec 2022 22:31:23 +0000 Subject: [PATCH 3/7] deploy try 3 --- app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 99c4c6a..f6e6a8c 100644 --- a/app.js +++ b/app.js @@ -1,9 +1,9 @@ if (process.env.NODE_ENV !== "production") { require('dotenv').config(); } -console.log('key ', process.env.CLOUDINARY_KEY) -console.log('cloudname ', process.env.CLOUDINARY_CLOUD_NAME) -console.log('cloudinary secret ', process.env.CLOUDINARY_SECRET) +// console.log('key ', process.env.CLOUDINARY_KEY) +// console.log('cloudname ', process.env.CLOUDINARY_CLOUD_NAME) +// console.log('cloudinary secret ', process.env.CLOUDINARY_SECRET) const express = require("express"); const app = express(); From adc1b120d504041c3e2f396d4693817240c04d7d Mon Sep 17 00:00:00 2001 From: wojciech krupa Date: Tue, 13 Dec 2022 22:37:50 +0000 Subject: [PATCH 4/7] deploy try 4 --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index f6e6a8c..90f4693 100644 --- a/app.js +++ b/app.js @@ -26,7 +26,7 @@ const LocalStrategy = require("passport-local"); const MongoStore = require('connect-mongo'); -const post = process.env.PORT || 3000; +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"; From 818db08bbee435f34b5b36eba60bd2966a503e95 Mon Sep 17 00:00:00 2001 From: wojciech krupa Date: Wed, 14 Dec 2022 19:04:07 +0000 Subject: [PATCH 5/7] deploy try - DBs should be connected now --- app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app.js b/app.js index 90f4693..f474df3 100644 --- a/app.js +++ b/app.js @@ -123,6 +123,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"); From 066b0d6cd49d1ae4af4e69c6deeae28d28f69c6d Mon Sep 17 00:00:00 2001 From: wojciech krupa Date: Wed, 14 Dec 2022 19:51:25 +0000 Subject: [PATCH 6/7] updated .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7d73e27..3040c84 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules/* .env to-dos.txt -/seeds/NO_PICTURE.jpg \ No newline at end of file +/seeds/NO_PICTURE.jpg +/seeds/seeds_to_mongoAtlas.json \ No newline at end of file From d8f2c6df9b9c607ebe30a3c84d09af26e1d3781b Mon Sep 17 00:00:00 2001 From: wojciech krupa Date: Sun, 16 Apr 2023 22:06:55 +0100 Subject: [PATCH 7/7] fixed imgs bug, changed text in home and showAll --- .gitignore | 3 ++- views/desserts/index.ejs | 5 +++-- views/desserts/show.ejs | 4 ++-- views/home.ejs | 3 +-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 3040c84..c188db4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules/* .env to-dos.txt /seeds/NO_PICTURE.jpg -/seeds/seeds_to_mongoAtlas.json \ No newline at end of file +/seeds/seeds_to_mongoAtlas.json +to fix.bmp \ No newline at end of file diff --git a/views/desserts/index.ejs b/views/desserts/index.ejs index 7c238fc..160557d 100644 --- a/views/desserts/index.ejs +++ b/views/desserts/index.ejs @@ -11,13 +11,14 @@