-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
28 lines (23 loc) · 711 Bytes
/
Copy pathmain.js
File metadata and controls
28 lines (23 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Koa from 'koa';
import logger from 'koa-logger';
import bodyParser from 'koa-bodyparser';
import cors from '@koa/cors';
import config from './config/app';
import router from './routes/index';
import db from './models/index';
import errorMiddleware from './errors/middleware';
import serialize from './resources/index';
import getAttributes from './middleware/get-attrubutes';
const app = new Koa();
app.db = db;
app.serialize = serialize;
app.use(errorMiddleware);
app.use(logger());
app.use(cors());
app.use(bodyParser());
app.use(getAttributes);
app.use(router.allowedMethods());
app.use(router.routes());
app.listen(config.port, () => {
console.log(`Started Server on Port ${config.port}`);
});