Fetch the firstname placeholder from nodejs

This commit is contained in:
Mylloon 2022-06-23 12:43:35 +02:00
parent 6d1829027b
commit 50274a8e52
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 10 additions and 2 deletions

View file

@ -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;

7
src/utils/utils.js Normal file
View file

@ -0,0 +1,7 @@
const randomFirstname = () => {
return "Maria";
};
module.exports = {
randomFirstname
};

View file

@ -27,7 +27,7 @@
<body>
<img src="images/logo.webp" class="img-fluid mx-auto d-block" alt="Banner">
<input id="firstname" class="form-control form-control-lg mx-auto d-block" type="text" placeholder="Maria">
<input id="firstname" class="form-control form-control-lg mx-auto d-block" type="text" placeholder="<%- firstname_placeholder %>">
<hr>
<figure class="text-center">