Add README on index

This commit is contained in:
Mylloon 2022-06-23 02:42:40 +02:00
parent 3b5933addd
commit 41996ca804
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 20 additions and 5 deletions

View file

@ -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 // Home Page
router.get('/', (_, res) => { 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
View 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
}

View file

@ -7,6 +7,7 @@
<title>Constnium</title> <title>Constnium</title>
</head> </head>
<body> <body>
<hr>
<%- readme %>
</body> </body>
</html> </html>