Serve Bootstrap and jQuery from key server origin. Use EJS for view rendering.

This commit is contained in:
Thomas Oberndörfer
2019-06-14 11:17:25 +02:00
parent 3367f08647
commit f399da9614
11 changed files with 221 additions and 182 deletions

View File

@@ -20,6 +20,7 @@
const Koa = require('koa');
const serve = require('koa-static');
const router = require('koa-router')();
const render = require('koa-ejs');
const locales = require('koa-locales');
const config = require('config');
const middleware = require('./middleware');
@@ -31,11 +32,19 @@ const PGP = require('../service/pgp');
const PublicKey = require('../service/public-key');
const app = new Koa();
render(app, {
root: `${__dirname}/../view`
});
locales(app);
let hkp;
let rest;
// UI views
router.get('/', ctx => ctx.render('index'));
router.redirect('/index.html', '/');
router.get('/manage.html', ctx => ctx.render('manage'));
// HKP and REST api routes
router.post('/pks/add', ctx => hkp.add(ctx));
router.get('/pks/lookup', ctx => hkp.lookup(ctx));