forked from joephon/drm_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
40 lines (30 loc) · 918 Bytes
/
server.js
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
32
33
34
35
36
37
38
39
require('dotenv').config()
const Koa = require('koa')
, app = new Koa()
, koaBody = require('koa-body')({
"formLimit":"5mb",
"jsonLimit":"5mb",
"textLimit":"5mb"
})
, path = require('path')
, router = require('./routes')
, db = require('./db')
, cors = require('koa2-cors')
, static = require('koa-static')
, WebSocket = require('./websocket')
, staticPath = './static'
, tcpSocket = require('./tcpSocket')
, redis = require('./redis')
app.use(static(path.join( __dirname, staticPath)))
app.use(cors())
var server = require('http').Server(app.callback())
var io = require('socket.io')(server)
app.use(koaBody)
app.use(router.routes())
app.use(router.allowedMethods())
// require('./changeFilePath')
new WebSocket(io)
//for test case
module.exports = app
server.listen(3000)
console.log('[drm] start-quick is starting at port 3000')