From 1840c2f7c91f5f89602a3683d85b0a9df1454855 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 11 Jun 2017 15:19:43 +0200 Subject: Update webpack stack --- server.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'server.ts') diff --git a/server.ts b/server.ts index b27a83860..60045865d 100644 --- a/server.ts +++ b/server.ts @@ -1,4 +1,6 @@ -if ([ 'dev', 'test'].indexOf(process.env.NODE_ENV) !== -1) { +import { isTestInstance } from './server/helpers/core-utils' + +if (isTestInstance()) { require('source-map-support').install() } @@ -11,6 +13,7 @@ import * as http from 'http' import * as morgan from 'morgan' import * as path from 'path' import * as bittorrentTracker from 'bittorrent-tracker' +import * as cors from 'cors' import { Server as WebSocketServer } from 'ws' const TrackerServer = bittorrentTracker.Server @@ -56,6 +59,14 @@ import { apiRouter, clientsRouter, staticRouter } from './server/controllers' // ----------- App ----------- +// Enable cors for develop +if (isTestInstance()) { + app.use(cors({ + origin: 'http://localhost:3000', + credentials: true + })) +} + // For the logger app.use(morgan('combined', { stream: { write: logger.info } -- cgit v1.2.3