aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/server.ts b/server.ts
index 119c0c61d..f5413b8e3 100644
--- a/server.ts
+++ b/server.ts
@@ -1,3 +1,7 @@
1if ([ 'dev', 'test'].indexOf(process.env.NODE_ENV) !== -1) {
2 require('source-map-support').install()
3}
4
1// ----------- Node modules ----------- 5// ----------- Node modules -----------
2import bodyParser = require('body-parser') 6import bodyParser = require('body-parser')
3import express = require('express') 7import express = require('express')
@@ -20,8 +24,8 @@ const app = express()
20import { logger } from './server/helpers/logger' 24import { logger } from './server/helpers/logger'
21import { API_VERSION, CONFIG } from './server/initializers/constants' 25import { API_VERSION, CONFIG } from './server/initializers/constants'
22// Initialize database and models 26// Initialize database and models
23const db = require('./server/initializers/database') 27import { database as db } from './server/initializers/database'
24db.init(onDatabaseInitDone) 28db.init(false, onDatabaseInitDone)
25 29
26// ----------- Checker ----------- 30// ----------- Checker -----------
27import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' 31import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker'
@@ -52,7 +56,9 @@ import { apiRouter, clientsRouter, staticRouter } from './server/controllers'
52// ----------- App ----------- 56// ----------- App -----------
53 57
54// For the logger 58// For the logger
55// app.use(morgan('combined', { stream: logger.stream })) 59app.use(morgan('combined', {
60 stream: { write: logger.info }
61}))
56// For body requests 62// For body requests
57app.use(bodyParser.json({ limit: '500kb' })) 63app.use(bodyParser.json({ limit: '500kb' }))
58app.use(bodyParser.urlencoded({ extended: false })) 64app.use(bodyParser.urlencoded({ extended: false }))
@@ -75,7 +81,7 @@ app.use('/', staticRouter)
75 81
76// Always serve index client page (the client is a single page application, let it handle routing) 82// Always serve index client page (the client is a single page application, let it handle routing)
77app.use('/*', function (req, res, next) { 83app.use('/*', function (req, res, next) {
78 res.sendFile(path.join(__dirname, './client/dist/index.html')) 84 res.sendFile(path.join(__dirname, '../client/dist/index.html'))
79}) 85})
80 86
81// ----------- Tracker ----------- 87// ----------- Tracker -----------