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, })