diff --git a/.gitignore b/.gitignore index 3f8e1d990..22bbbe69c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -.vscode/* \ No newline at end of file +.vscode/* +.env \ No newline at end of file diff --git a/config/.env b/config/.env deleted file mode 100644 index dbe126e0a..000000000 --- a/config/.env +++ /dev/null @@ -1,2 +0,0 @@ -PORT = 2121 -DB_STRING = mongodb+srv://demo:demo@cluster0.hcds1.mongodb.net/todos?retryWrites=true&w=majority \ No newline at end of file diff --git a/config/database.js b/config/database.js index 4aac3a233..631e2fbd0 100644 --- a/config/database.js +++ b/config/database.js @@ -1,4 +1,5 @@ const mongoose = require('mongoose') +console.log(process.env.PORT) const connectDB = async () => { try { diff --git a/package-lock.json b/package-lock.json index f5d8debf0..018e63706 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "bcrypt": "^5.0.1", "connect-mongo": "^3.2.0", - "dotenv": "^8.2.0", + "dotenv": "^8.6.0", "ejs": "^3.1.6", "express": "^4.17.1", "express-flash": "^0.0.2", @@ -523,11 +523,11 @@ } }, "node_modules/dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", "engines": { - "node": ">=8" + "node": ">=10" } }, "node_modules/ee-first": { @@ -2324,9 +2324,9 @@ "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==" }, "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==" }, "ee-first": { "version": "1.1.1", diff --git a/package.json b/package.json index 8c294b38a..a1f9ba17b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dependencies": { "bcrypt": "^5.0.1", "connect-mongo": "^3.2.0", - "dotenv": "^8.2.0", + "dotenv": "^8.6.0", "ejs": "^3.1.6", "express": "^4.17.1", "express-flash": "^0.0.2", diff --git a/public/css/style.css b/public/css/style.css index fbd6b929e..428684f8b 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,10 +1,66 @@ -h1{ - color: red; -} + .completed{ text-decoration: line-through; color: gray; } .not{ text-decoration: underline; +} + +.container { + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; +} + +.main { + display: flex; + flex-direction: column; + border: 1px solid rgb(64, 109, 12); + min-width: 50%; + border-radius: 20px; + padding: 50px; + margin: 10px; + box-shadow: 1px 1px 1px 1px black; +} + +.button { + width: 120px; + height: 40px; + color: white; + background: rgba(64, 109, 12, 0.5); + border-radius: 10px; + display: flex; + align-items: center; + justify-content: center; +} + +a{ + text-decoration: none; +} + +.btn-containers { + display: flex; + justify-content: center; + align-items: center; + gap: 20px; + +} + +.form { + display: flex; + flex-direction: column; + align-self: center; + gap: 10px; + margin: 0; +} + +.form input { + width: 100%; + height: 10%; +} + +.register { + padding: 20px; } \ No newline at end of file diff --git a/server.js b/server.js index b031c4cad..e2a3c4692 100644 --- a/server.js +++ b/server.js @@ -9,6 +9,7 @@ const logger = require('morgan') const connectDB = require('./config/database') const mainRoutes = require('./routes/main') const todoRoutes = require('./routes/todos') +const path = require('path') require('dotenv').config({path: './config/.env'}) @@ -40,7 +41,7 @@ app.use(flash()) app.use('/', mainRoutes) app.use('/todos', todoRoutes) - + app.listen(process.env.PORT, ()=>{ console.log('Server is running, you better catch it!') }) \ No newline at end of file diff --git a/views/index.ejs b/views/index.ejs index 774fc9b53..a381f7c3f 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -4,11 +4,21 @@ + Document -

Create Your VERY OWN Todolist!

- Login - Signup +
+
+

Create Your VERY OWN Todolist!

+ + +
+ +
+ \ No newline at end of file diff --git a/views/login.ejs b/views/login.ejs index 8c2479ce0..2ab7b4576 100644 --- a/views/login.ejs +++ b/views/login.ejs @@ -4,23 +4,29 @@ + Document - <% if (locals.messages.errors) { %> - <% messages.errors.forEach( el => { %> -
<%= el.msg %>
- <% }) %> - <% } %> - <% if (locals.messages.info) { %> - <% messages.info.forEach( el => { %> -
<%= el.msg %>
- <% }) %> - <% } %> -
- - - -
+
+
+ <% if (locals.messages.errors) { %> + <% messages.errors.forEach( el => { %> +
<%= el.msg %>
+ <% }) %> + <% } %> + <% if (locals.messages.info) { %> + <% messages.info.forEach( el => { %> +
<%= el.msg %>
+ <% }) %> + <% } %> +
+ + + +
+
+
+ \ No newline at end of file diff --git a/views/signup.ejs b/views/signup.ejs index 409d7045b..44c289223 100644 --- a/views/signup.ejs +++ b/views/signup.ejs @@ -4,20 +4,26 @@ + Document - <% if (locals.messages.errors) { %> - <% messages.errors.forEach( el => { %> -
<%= el.msg %>
- <% }) %> - <% } %> -
- - - - - -
+
+
+ <% if (locals.messages.errors) { %> + <% messages.errors.forEach( el => { %> +
<%= el.msg %>
+ <% }) %> + <% } %> +
+ + + + + +
+
+
+ \ No newline at end of file diff --git a/views/todos.ejs b/views/todos.ejs index d76747a08..278b84dda 100644 --- a/views/todos.ejs +++ b/views/todos.ejs @@ -8,24 +8,29 @@ -

Todos

- - -

<%= user.userName %> has <%= left %> things left to do.

- -
- - -
- - Logout +
+
+

Todos

+ + +

<%= user.userName %> has <%= left %> things left to do.

+ +
+ + +
+ + Logout +
+
+