Skip to content

Commit

Permalink
Added the initial dynamic content
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlmneves committed Aug 26, 2020
1 parent 2c40848 commit 4d91155
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 10 deletions.
49 changes: 44 additions & 5 deletions routes/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
const express = require("express");
const express = require('express');
const router = express.Router();
const fetch = require('node-fetch');

router.get("/", function (req, res, next) {
res.render("index", { title: "Fed Pug Boilerplate with Express" });
});
const requestOptions = {
method: 'GET',
redirect: 'follow'
}

module.exports = router;
let heroSection = null
let appsSection = null;

const heroSectionContent = fetch('https://express-api.victorneves.dev/hero_section/read.php', requestOptions)
.then((resp) => resp.json())
.then((res) => {
return res
})
.catch((error) => console.log(JSON.stringify(error)));

heroSectionContent.then(function (res) {
heroSection = res.records[0];
});

const appsSectionContent = fetch('https://express-api.victorneves.dev/apps_section/read.php', requestOptions)
.then((resp) => resp.json())
.then((res) => {
const obj = {
title: res.records[0].title,
text: {
__class: res.records[0].text_css,
text: res.records[0].text,
},
}

return obj
})
.catch((error) => console.log(JSON.stringify(error)));

appsSectionContent.then(function (res) {
appsSection = res;
});

router.get("/", function (req, res, next) {
res.render("index", { heroSection, appsSection });
})

module.exports = router
10 changes: 5 additions & 5 deletions views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ block content
section.section.section--hero
.section__inner.section__inner--row
.section__content.section__content--left
+sectionTitle('Track your shows automatically', 'section__title--hero')
+sectionText('With ShowTrackr you can track your favorite TV shows automatically, so you never loose track of your TV shows ever again')
+sectionTitle(heroSection.title, heroSection.modifier_css)
+sectionText(heroSection.text)
form.newsletter
.newsletter__inner
+form({
Expand Down Expand Up @@ -62,7 +62,7 @@ block content
altText: 'Synology'
}
])
+heroImage('App mockup', 'images/mockup-app-iphone-x.png', 'section__img')
+heroImage(heroSection.alt_text, `images/${heroSection.image}`, heroSection.image_css)

section.section.section--features
.section__inner.section__inner--features
Expand Down Expand Up @@ -137,8 +137,8 @@ block content
section.section.section--apps
.section__inner.section__inner--row
.section__content.section__content--left
+sectionTitle('Easy-to-use interfaces on every platform')
+text({__class: 'section__text', text: 'Since most of our features work in a completely automated way, you will mainly use our apps to discover new TV shows recommended for you and discuss the most interesting episodes with like-minded people.'})
+sectionTitle(appsSection.title)
+text(appsSection.text)
+interfaceTabs([
{
input: {
Expand Down

0 comments on commit 4d91155

Please sign in to comment.