diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-11 15:19:43 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-11 15:19:43 +0200 |
commit | 1840c2f7c91f5f89602a3683d85b0a9df1454855 (patch) | |
tree | 7efc223222e2d318abfaef0839a79e23be727cea /server.ts | |
parent | 8635a2c70cc24a4c52558162ac058de95750271f (diff) | |
download | PeerTube-1840c2f7c91f5f89602a3683d85b0a9df1454855.tar.gz PeerTube-1840c2f7c91f5f89602a3683d85b0a9df1454855.tar.zst PeerTube-1840c2f7c91f5f89602a3683d85b0a9df1454855.zip |
Update webpack stack
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,4 +1,6 @@ | |||
1 | if ([ 'dev', 'test'].indexOf(process.env.NODE_ENV) !== -1) { | 1 | import { isTestInstance } from './server/helpers/core-utils' |
2 | |||
3 | if (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' | |||
11 | import * as morgan from 'morgan' | 13 | import * as morgan from 'morgan' |
12 | import * as path from 'path' | 14 | import * as path from 'path' |
13 | import * as bittorrentTracker from 'bittorrent-tracker' | 15 | import * as bittorrentTracker from 'bittorrent-tracker' |
16 | import * as cors from 'cors' | ||
14 | import { Server as WebSocketServer } from 'ws' | 17 | import { Server as WebSocketServer } from 'ws' |
15 | 18 | ||
16 | const TrackerServer = bittorrentTracker.Server | 19 | const 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 | ||
63 | if (isTestInstance()) { | ||
64 | app.use(cors({ | ||
65 | origin: 'http://localhost:3000', | ||
66 | credentials: true | ||
67 | })) | ||
68 | } | ||
69 | |||
59 | // For the logger | 70 | // For the logger |
60 | app.use(morgan('combined', { | 71 | app.use(morgan('combined', { |
61 | stream: { write: logger.info } | 72 | stream: { write: logger.info } |