Improve caching

pull/20/head
Joe Biellik 4 years ago
parent 47c31929dc
commit 419a20c25e

@ -3,7 +3,7 @@ const app = new koa();
const config = require('config');
const path = require('path');
const router = require('./router');
require('./db')();
require('./db');
app.keys = config.keys;
app.proxy = true;

@ -4,6 +4,8 @@ const pastes = require('./controllers/pastes');
router
.get('/', async (ctx) => {
ctx.set('Cache-Control', 'no-cache');
await ctx.render('index', {
pretty: config.prettyHtml,
title: config.name,
@ -13,6 +15,6 @@ router
});
})
.post('/', pastes.create)
.get('/:id', pastes.view);
.get('/:id', require('koa-conditional-get')(), require('koa-etag')(), pastes.view);
module.exports = router;

Loading…
Cancel
Save