17 lines
433 B
JavaScript
17 lines
433 B
JavaScript
import Koa from 'koa';
|
|
import * as config from './config.mjs';
|
|
import Router from 'koa-router';
|
|
import cors from '@koa/cors';
|
|
import jwt from 'koa-jwt';
|
|
import bodyParser from 'koa-bodyparser';
|
|
|
|
const app = new Koa();
|
|
const router = new Router();
|
|
|
|
app.use(cors());
|
|
app.use(bodyParser());
|
|
app.use(jwt({ secret: config.secret, passthrough: true }));
|
|
app.use(router.routes());
|
|
app.use(router.allowedMethods());
|
|
app.listen(config.port);
|