From e02643f32e4c97ca307f8fc5b69be79c40d70a3b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 22 May 2017 20:58:25 +0200 Subject: Type models --- server.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'server.ts') diff --git a/server.ts b/server.ts index 119c0c61d..f5413b8e3 100644 --- a/server.ts +++ b/server.ts @@ -1,3 +1,7 @@ +if ([ 'dev', 'test'].indexOf(process.env.NODE_ENV) !== -1) { + require('source-map-support').install() +} + // ----------- Node modules ----------- import bodyParser = require('body-parser') import express = require('express') @@ -20,8 +24,8 @@ const app = express() import { logger } from './server/helpers/logger' import { API_VERSION, CONFIG } from './server/initializers/constants' // Initialize database and models -const db = require('./server/initializers/database') -db.init(onDatabaseInitDone) +import { database as db } from './server/initializers/database' +db.init(false, onDatabaseInitDone) // ----------- Checker ----------- import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' @@ -52,7 +56,9 @@ import { apiRouter, clientsRouter, staticRouter } from './server/controllers' // ----------- App ----------- // For the logger -// app.use(morgan('combined', { stream: logger.stream })) +app.use(morgan('combined', { + stream: { write: logger.info } +})) // For body requests app.use(bodyParser.json({ limit: '500kb' })) app.use(bodyParser.urlencoded({ extended: false })) @@ -75,7 +81,7 @@ app.use('/', staticRouter) // Always serve index client page (the client is a single page application, let it handle routing) app.use('/*', function (req, res, next) { - res.sendFile(path.join(__dirname, './client/dist/index.html')) + res.sendFile(path.join(__dirname, '../client/dist/index.html')) }) // ----------- Tracker ----------- -- cgit v1.2.3