You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paste/router.js

21 lines
519 B
JavaScript

const router = require('koa-router')();
const config = require('config');
const pastes = require('./controllers/pastes');
9 years ago
router
.get('/', async (ctx) => {
4 years ago
ctx.set('Cache-Control', 'no-cache');
await ctx.render('index', {
pretty: config.prettyHtml,
title: config.name,
url: ctx.request.origin,
expires: config.expires,
highlights: config.highlights
});
})
.post('/', pastes.create)
4 years ago
.get('/:id', require('koa-conditional-get')(), require('koa-etag')(), pastes.view);
9 years ago
module.exports = router;