From 0961d4b2dd6d05c3aaac29b2db847ddf1d7f7c1b Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Mon, 11 Oct 2021 00:22:44 +0000 Subject: [PATCH] Remove some koa leftovers --- api/error.mjs | 12 ------------ api/server.mjs | 17 ----------------- 2 files changed, 29 deletions(-) diff --git a/api/error.mjs b/api/error.mjs index 01f65b9..89dbc52 100644 --- a/api/error.mjs +++ b/api/error.mjs @@ -5,15 +5,3 @@ export class HttpError extends Error { this.status = status } } - -export async function errorMiddleware(ctx, next) { - try { - await next() - } catch (e) { - ctx.status = e.status || 500 - ctx.body = { - status: ctx.status, - message: e.message, - } - } -} diff --git a/api/server.mjs b/api/server.mjs index 26bfab4..57b1dc7 100644 --- a/api/server.mjs +++ b/api/server.mjs @@ -1,5 +1,4 @@ import { performance } from 'perf_hooks' -import Koa from 'koa-lite' import { Flaska, QueryHandler } from 'flaska' import TestRoutes from './test/routes.mjs' @@ -8,22 +7,6 @@ import MediaRoutes from './media/routes.mjs' import config from './config.mjs' import log from './log.mjs' -/* -import router from './router.mjs' -import { errorMiddleware } from './error.mjs' - -const app = new Koa() - -app.use(errorMiddleware) -app.use(router.routes()) -app.use(router.allowedMethods()) - -const server = app.listen(config.get('server:port'), function(a,b) { - log.info(`Server listening at ${config.get('server:port')}`) -}) - -export default server */ - const app = new Flaska({ log: log, })