Fetch the firstname placeholder from nodejs
This commit is contained in:
parent
6d1829027b
commit
50274a8e52
3 changed files with 10 additions and 2 deletions
|
@ -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
7
src/utils/utils.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const randomFirstname = () => {
|
||||
return "Maria";
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
randomFirstname
|
||||
};
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue