From c9dd2c5374cdb0fc5002e2bdeafed7d9551e61de Mon Sep 17 00:00:00 2001 From: saira512dev <512saira@gmail.com> Date: Sat, 1 Oct 2022 06:40:07 +0530 Subject: [PATCH 1/3] improved UI --- config/.env | 3 ++- config/database.js | 1 + package-lock.json | 16 ++++++------ package.json | 2 +- public/css/style.css | 62 +++++++++++++++++++++++++++++++++++++++++--- server.js | 3 ++- views/index.ejs | 16 +++++++++--- views/login.ejs | 36 ++++++++++++++----------- views/signup.ejs | 30 ++++++++++++--------- views/todos.ejs | 41 ++++++++++++++++------------- 10 files changed, 148 insertions(+), 62 deletions(-) diff --git a/config/.env b/config/.env index dbe126e0a..609c4cec6 100644 --- a/config/.env +++ b/config/.env @@ -1,2 +1,3 @@ PORT = 2121 -DB_STRING = mongodb+srv://demo:demo@cluster0.hcds1.mongodb.net/todos?retryWrites=true&w=majority \ No newline at end of file +NODE_ENV = development +DB_STRING = 'mongodb+srv://quiz_user:quizUser_109@clusterquiz.qu2x8.mongodb.net/Todo-Auth?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 @@ +