-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (30 loc) · 768 Bytes
/
index.js
File metadata and controls
31 lines (30 loc) · 768 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
29
30
31
import Koa from 'koa';
const app = new Koa();
import Router from 'koa-router';
const PORT = 8080;
const cors = require('@koa/cors');
import serve from 'koa-static'
let corsOptions = {
origin: "https://ssangsang.weconnect.support",
credentials: true,
}
/*
let c = {
origin: "http://localhost:3000",
credentials: true
}
*/
app.use(cors(corsOptions));
//app.use(cors(c));
const router = new Router();
import index from './routes/index.js';
import bodyParser from 'koa-bodyparser';
import mount from 'koa-mount';
app.use(bodyParser());
app.use(mount('/img',serve(__dirname + "/img")))
router.use(index.routes());
app.use(router.routes());
app.use(router.allowedMethods());
app.listen(PORT, () => {
console.log(`ssangsang API Server START : PORT - ${PORT}`);
});