infoscreens/server/index.js

24 lines
484 B
JavaScript
Raw Normal View History

2018-12-24 13:45:01 +01:00
const Koa = require('koa');
const Router = require('koa-router');
const Static = require('koa-static');
2018-12-24 14:08:36 +01:00
const Cors = require('koa-cors');
2018-12-24 13:45:01 +01:00
const path = require('path');
2018-12-24 14:23:22 +01:00
const route35c3 = require('./route/35c3');
2018-12-24 13:45:01 +01:00
const app = new Koa();
const router = new Router();
2018-12-24 14:23:22 +01:00
route35c3(router);
2018-12-24 13:45:01 +01:00
app
2018-12-24 14:08:36 +01:00
.use(Cors())
2018-12-24 13:45:01 +01:00
.use(router.routes())
.use(router.allowedMethods())
.use(Static(path.resolve(__dirname, '../dist'), {}));
module.exports = app;
if (!module.parent) {
app.listen(8080);
}