Add README on index
This commit is contained in:
parent
3b5933addd
commit
41996ca804
3 changed files with 20 additions and 5 deletions
|
@ -1,8 +1,12 @@
|
|||
const router = require('express').Router();
|
||||
const router = require('express').Router()
|
||||
const marked = require('marked')
|
||||
|
||||
const readme = require('../utils/readme')
|
||||
|
||||
// Home Page
|
||||
router.get('/', (_, res) => {
|
||||
res.render('index');
|
||||
});
|
||||
readme.data()
|
||||
.then(data => res.render('index', { readme: marked.parse(data) }))
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
10
src/utils/readme.js
Normal file
10
src/utils/readme.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const fetch = require('node-fetch')
|
||||
|
||||
async function data () {
|
||||
return await fetch('https://git.kennel.ml/Anri/Constnium/raw/branch/main/README.md')
|
||||
.then(res => res.text())
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
<title>Constnium</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<hr>
|
||||
<%- readme %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue