diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-22 20:58:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-25 17:32:16 +0200 |
commit | e02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch) | |
tree | b7f6269913cd5a0e4f26a9461a043deb0c168be0 /server.ts | |
parent | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff) | |
download | PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip |
Type models
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1,3 +1,7 @@ | |||
1 | if ([ 'dev', 'test'].indexOf(process.env.NODE_ENV) !== -1) { | ||
2 | require('source-map-support').install() | ||
3 | } | ||
4 | |||
1 | // ----------- Node modules ----------- | 5 | // ----------- Node modules ----------- |
2 | import bodyParser = require('body-parser') | 6 | import bodyParser = require('body-parser') |
3 | import express = require('express') | 7 | import express = require('express') |
@@ -20,8 +24,8 @@ const app = express() | |||
20 | import { logger } from './server/helpers/logger' | 24 | import { logger } from './server/helpers/logger' |
21 | import { API_VERSION, CONFIG } from './server/initializers/constants' | 25 | import { API_VERSION, CONFIG } from './server/initializers/constants' |
22 | // Initialize database and models | 26 | // Initialize database and models |
23 | const db = require('./server/initializers/database') | 27 | import { database as db } from './server/initializers/database' |
24 | db.init(onDatabaseInitDone) | 28 | db.init(false, onDatabaseInitDone) |
25 | 29 | ||
26 | // ----------- Checker ----------- | 30 | // ----------- Checker ----------- |
27 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' | 31 | import { 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 })) | 59 | app.use(morgan('combined', { |
60 | stream: { write: logger.info } | ||
61 | })) | ||
56 | // For body requests | 62 | // For body requests |
57 | app.use(bodyParser.json({ limit: '500kb' })) | 63 | app.use(bodyParser.json({ limit: '500kb' })) |
58 | app.use(bodyParser.urlencoded({ extended: false })) | 64 | app.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) |
77 | app.use('/*', function (req, res, next) { | 83 | app.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 ----------- |