aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-11 15:19:43 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-11 15:19:43 +0200
commit1840c2f7c91f5f89602a3683d85b0a9df1454855 (patch)
tree7efc223222e2d318abfaef0839a79e23be727cea /server.ts
parent8635a2c70cc24a4c52558162ac058de95750271f (diff)
downloadPeerTube-1840c2f7c91f5f89602a3683d85b0a9df1454855.tar.gz
PeerTube-1840c2f7c91f5f89602a3683d85b0a9df1454855.tar.zst
PeerTube-1840c2f7c91f5f89602a3683d85b0a9df1454855.zip
Update webpack stack
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/server.ts b/server.ts
index b27a83860..60045865d 100644
--- a/server.ts
+++ b/server.ts
@@ -1,4 +1,6 @@
1if ([ 'dev', 'test'].indexOf(process.env.NODE_ENV) !== -1) { 1import { isTestInstance } from './server/helpers/core-utils'
2
3if (isTestInstance()) {
2 require('source-map-support').install() 4 require('source-map-support').install()
3} 5}
4 6
@@ -11,6 +13,7 @@ import * as http from 'http'
11import * as morgan from 'morgan' 13import * as morgan from 'morgan'
12import * as path from 'path' 14import * as path from 'path'
13import * as bittorrentTracker from 'bittorrent-tracker' 15import * as bittorrentTracker from 'bittorrent-tracker'
16import * as cors from 'cors'
14import { Server as WebSocketServer } from 'ws' 17import { Server as WebSocketServer } from 'ws'
15 18
16const TrackerServer = bittorrentTracker.Server 19const TrackerServer = bittorrentTracker.Server
@@ -56,6 +59,14 @@ import { apiRouter, clientsRouter, staticRouter } from './server/controllers'
56 59
57// ----------- App ----------- 60// ----------- App -----------
58 61
62// Enable cors for develop
63if (isTestInstance()) {
64 app.use(cors({
65 origin: 'http://localhost:3000',
66 credentials: true
67 }))
68}
69
59// For the logger 70// For the logger
60app.use(morgan('combined', { 71app.use(morgan('combined', {
61 stream: { write: logger.info } 72 stream: { write: logger.info }