From 50274a8e52f7df8a9989b84375cbbe01d39fb2b8 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 23 Jun 2022 12:43:35 +0200 Subject: [PATCH] Fetch the firstname placeholder from nodejs --- src/routes/index.js | 3 ++- src/utils/utils.js | 7 +++++++ src/views/index.ejs | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 src/utils/utils.js diff --git a/src/routes/index.js b/src/routes/index.js index 45828d4..585a9ca 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -2,11 +2,12 @@ const router = require('express').Router(); const marked = require('marked'); const readme = require('../utils/readme'); +const utils = require('../utils/utils'); // Home Page router.get('/', (_, res) => { readme.get() - .then(data => res.render('index', { readme: marked.parse(data) })); + .then(data => res.render('index', { readme: marked.parse(data), firstname_placeholder: utils.randomFirstname() })); }); module.exports = router; diff --git a/src/utils/utils.js b/src/utils/utils.js new file mode 100644 index 0000000..b717c4c --- /dev/null +++ b/src/utils/utils.js @@ -0,0 +1,7 @@ +const randomFirstname = () => { + return "Maria"; +}; + +module.exports = { + randomFirstname +}; diff --git a/src/views/index.ejs b/src/views/index.ejs index 2f97ec5..0b34070 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -27,7 +27,7 @@ Banner - +