aboutsummaryrefslogtreecommitdiff
path: root/src/server.js
diff options
context:
space:
mode:
authorGitea <gitea@fake.local>2021-03-13 14:34:54 -0600
committerGitea <gitea@fake.local>2021-03-13 14:34:54 -0600
commitd5f2c72acd877acbb3683b50cfbbe9f3c0d98af3 (patch)
treed7ef02c50f80e7346acdbfe2fefceb25f57e4671 /src/server.js
parent8a0a3a00e75dc2351a7218d0059b87f7e9345871 (diff)
Add meta description and sitemap
Diffstat (limited to 'src/server.js')
-rw-r--r--src/server.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/server.js b/src/server.js
index 58d29fb..c770304 100644
--- a/src/server.js
+++ b/src/server.js
@@ -147,9 +147,6 @@ function setUpRoutes(models, jwtFunctions, database, templates) {
let body = templates["blog-single"]({posts, date});
res.status(200).send(body)
})
-<<<<<<< HEAD
- server.get('/tags/:name', cache('5 minutes'), async (req, res) => {
-=======
server.get('/post/like/:type/:id', async (req, res) => {
let type = req.params.type
let id = req.params.id
@@ -159,8 +156,7 @@ function setUpRoutes(models, jwtFunctions, database, templates) {
post.update({likes: post.likes+1})
res.status(200).send({likes: post.likes});
})
- server.get('/tags/:name', async (req, res) => {
->>>>>>> 5b5dc610bc0da17fd006982de50b4dc74b134a54
+ server.get('/tags/:name', cache('5 minutes'), async (req, res) => {
const { name } = req.params;
const postsWithTag = await models.tags.findAll({ attributes: ["postId"], where: { text: name } })
.map(function (x) {
@@ -179,6 +175,8 @@ function setUpRoutes(models, jwtFunctions, database, templates) {
res.status(200).send(body)
})
+ server.get('/sitemap.xml', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/misc/sitemap.xml"));
+ server.get('/robots.txt', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/misc/robots.txt"));
server.get('/admin', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/html/admin.html"));
server.get('/login', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/html/login.html"))
server.get('/email', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/html/email.html"))