From 4bcf8dd8127a6b8d63d8279881af9b13c98aa732 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Mon, 5 May 2025 14:21:30 -0700 Subject: [PATCH] feature/started work on layout.ejs --- app.js | 26 +++++++++++++------------- src/views/index.ejs | 15 +-------------- src/views/layout.ejs | 13 +++++++++++++ src/views/signup.ejs | 5 ----- 4 files changed, 27 insertions(+), 32 deletions(-) create mode 100644 src/views/layout.ejs diff --git a/app.js b/app.js index 2fc8319..c091745 100644 --- a/app.js +++ b/app.js @@ -18,23 +18,23 @@ app.use(session({ })); /*** Database ***/ -const { connectMongo, getCollection } = require("./src/database/connection"); +// const { connectMongo, getCollection } = require("./src/database/connection"); -let users; -async function initDatabase() { - const mongoURI = process.env.mongoURI || "mongodb://localhost:27017/"; - const database = process.env.database || "knoldus"; // Database name +// let users; +// async function initDatabase() { +// const mongoURI = process.env.mongoURI || "mongodb://localhost:27017/"; +// const database = process.env.database || "knoldus"; // Database name - const db = await connectMongo(mongoURI, database); +// const db = await connectMongo(mongoURI, database); - // For any collection, init here - users = await getCollection(db, "users"); -} +// // For any collection, init here +// users = await getCollection(db, "users"); +// } -initDatabase().then(() => { - require("./src/auth/authentication")(app, users); -}); +// initDatabase().then(() => { +// require("./src/auth/authentication")(app, users); +// }); /* ROUTINGS @@ -42,7 +42,7 @@ ROUTINGS app.get('/', (req, res) => { if (!req.session.errMessage) req.session.errMessage = ""; - res.render('index'); + res.render('layout'); }); app.get('/landing', (req, res) => { diff --git a/src/views/index.ejs b/src/views/index.ejs index 04287c1..20ea401 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -1,14 +1 @@ - - - - - - - Document - - - - The Index page - - - +

The index page

\ No newline at end of file diff --git a/src/views/layout.ejs b/src/views/layout.ejs new file mode 100644 index 0000000..92b7356 --- /dev/null +++ b/src/views/layout.ejs @@ -0,0 +1,13 @@ + + + + + + + + <%= title %> + + + <%- include(filename, locals) %> + + \ No newline at end of file diff --git a/src/views/signup.ejs b/src/views/signup.ejs index c471971..fc28f8a 100644 --- a/src/views/signup.ejs +++ b/src/views/signup.ejs @@ -6,11 +6,6 @@ Signup - - -