Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
completed integration except for forms
Browse files Browse the repository at this point in the history
  • Loading branch information
furkansimsekli committed Sep 25, 2022
1 parent 452b671 commit 24c7c46
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ app.listen(port, (err) => {
console.log(err)
} else {
console.log(`Server listening on ${port}`);
// connectToMongo();
connectToMongo();
}
});

Expand Down
19 changes: 14 additions & 5 deletions controllers/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
const content = require('../models/content');
const Member = require('../models/member');
const Faq = content.Faq;
const Event = content.Event;
const Project = content.Project;
const Course = content.Course;

const boilerplate = "layouts/boilerplate";
const errorPage = "../error";

// Page contents are hardcoded right now, will be fixed later!

const renderHomePage = async (req, res) => {
res.redirect("/about");
Expand All @@ -10,7 +16,6 @@ const renderHomePage = async (req, res) => {
const renderAboutPage = async (req, res) => {
try {
const page = "../sections/about";
fooText = "Hakkımızda";
res.render(boilerplate, { page });
} catch (err) {
res.render(boilerplate, { page: errorPage, err });
Expand All @@ -20,7 +25,8 @@ const renderAboutPage = async (req, res) => {
const renderFaqPage = async (req, res) => {
try {
const page = "../sections/faq";
res.render(boilerplate, { page });
const faqs = await Faq.find({});
res.render(boilerplate, { page, faqs });
} catch (err) {
res.render(boilerplate, { page: errorPage, err });
}
Expand All @@ -29,7 +35,9 @@ const renderFaqPage = async (req, res) => {
const renderEventsPage = async (req, res) => {
try {
const page = "../sections/events";
res.render(boilerplate, { page });
const events = await Event.find({});
const courses = await Course.find({});
res.render(boilerplate, { page, events, courses });
} catch (err) {
res.render(boilerplate, { page: errorPage, err });
}
Expand All @@ -38,7 +46,8 @@ const renderEventsPage = async (req, res) => {
const renderArgePage = async (req, res) => {
try {
const page = "../sections/arge";
res.render(boilerplate, { page });
const projects = await Project.find({});
res.render(boilerplate, { page, projects });
} catch (err) {
res.render(boilerplate, { page: errorPage, err });
}
Expand Down

0 comments on commit 24c7c46

Please sign in to comment.