diff options
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -7,16 +7,14 @@ if (isTestInstance()) { | |||
7 | // ----------- Node modules ----------- | 7 | // ----------- Node modules ----------- |
8 | import * as bodyParser from 'body-parser' | 8 | import * as bodyParser from 'body-parser' |
9 | import * as express from 'express' | 9 | import * as express from 'express' |
10 | // FIXME: cannot import express-validator | ||
11 | const expressValidator = require('express-validator') | ||
12 | import * as http from 'http' | 10 | import * as http from 'http' |
13 | import * as morgan from 'morgan' | 11 | import * as morgan from 'morgan' |
14 | import * as path from 'path' | 12 | import * as path from 'path' |
15 | import * as bittorrentTracker from 'bittorrent-tracker' | 13 | import * as bitTorrentTracker from 'bittorrent-tracker' |
16 | import * as cors from 'cors' | 14 | import * as cors from 'cors' |
17 | import { Server as WebSocketServer } from 'ws' | 15 | import { Server as WebSocketServer } from 'ws' |
18 | 16 | ||
19 | const TrackerServer = bittorrentTracker.Server | 17 | const TrackerServer = bitTorrentTracker.Server |
20 | 18 | ||
21 | process.title = 'peertube' | 19 | process.title = 'peertube' |
22 | 20 | ||
@@ -49,7 +47,6 @@ db.init(false).then(() => onDatabaseInitDone()) | |||
49 | // ----------- PeerTube modules ----------- | 47 | // ----------- PeerTube modules ----------- |
50 | import { migrate, installApplication } from './server/initializers' | 48 | import { migrate, installApplication } from './server/initializers' |
51 | import { JobScheduler, activateSchedulers, VideosPreviewCache } from './server/lib' | 49 | import { JobScheduler, activateSchedulers, VideosPreviewCache } from './server/lib' |
52 | import * as customValidators from './server/helpers/custom-validators' | ||
53 | import { apiRouter, clientsRouter, staticRouter } from './server/controllers' | 50 | import { apiRouter, clientsRouter, staticRouter } from './server/controllers' |
54 | 51 | ||
55 | // ----------- Command line ----------- | 52 | // ----------- Command line ----------- |
@@ -81,10 +78,6 @@ app.use(morgan('combined', { | |||
81 | // For body requests | 78 | // For body requests |
82 | app.use(bodyParser.json({ limit: '500kb' })) | 79 | app.use(bodyParser.json({ limit: '500kb' })) |
83 | app.use(bodyParser.urlencoded({ extended: false })) | 80 | app.use(bodyParser.urlencoded({ extended: false })) |
84 | // Validate some params for the API | ||
85 | app.use(expressValidator({ | ||
86 | customValidators: customValidators | ||
87 | })) | ||
88 | 81 | ||
89 | // ----------- Views, routes and static files ----------- | 82 | // ----------- Views, routes and static files ----------- |
90 | 83 | ||