aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-15 12:17:08 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-15 12:17:08 +0200
commitb60e5f38daf77e720a27aa86d3b482c58906a03a (patch)
treea70909860ab9705d348b3c082f8af440e0a5e4d2 /server.ts
parent315cc0cc1871ab2a6d6c1bb61cf7b9f10511c3a9 (diff)
downloadPeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.tar.gz
PeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.tar.zst
PeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.zip
Upgrade express validator to v4
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts11
1 files changed, 2 insertions, 9 deletions
diff --git a/server.ts b/server.ts
index 80bf118c0..3f2d27718 100644
--- a/server.ts
+++ b/server.ts
@@ -7,16 +7,14 @@ if (isTestInstance()) {
7// ----------- Node modules ----------- 7// ----------- Node modules -----------
8import * as bodyParser from 'body-parser' 8import * as bodyParser from 'body-parser'
9import * as express from 'express' 9import * as express from 'express'
10// FIXME: cannot import express-validator
11const expressValidator = require('express-validator')
12import * as http from 'http' 10import * as http from 'http'
13import * as morgan from 'morgan' 11import * as morgan from 'morgan'
14import * as path from 'path' 12import * as path from 'path'
15import * as bittorrentTracker from 'bittorrent-tracker' 13import * as bitTorrentTracker from 'bittorrent-tracker'
16import * as cors from 'cors' 14import * as cors from 'cors'
17import { Server as WebSocketServer } from 'ws' 15import { Server as WebSocketServer } from 'ws'
18 16
19const TrackerServer = bittorrentTracker.Server 17const TrackerServer = bitTorrentTracker.Server
20 18
21process.title = 'peertube' 19process.title = 'peertube'
22 20
@@ -49,7 +47,6 @@ db.init(false).then(() => onDatabaseInitDone())
49// ----------- PeerTube modules ----------- 47// ----------- PeerTube modules -----------
50import { migrate, installApplication } from './server/initializers' 48import { migrate, installApplication } from './server/initializers'
51import { JobScheduler, activateSchedulers, VideosPreviewCache } from './server/lib' 49import { JobScheduler, activateSchedulers, VideosPreviewCache } from './server/lib'
52import * as customValidators from './server/helpers/custom-validators'
53import { apiRouter, clientsRouter, staticRouter } from './server/controllers' 50import { 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
82app.use(bodyParser.json({ limit: '500kb' })) 79app.use(bodyParser.json({ limit: '500kb' }))
83app.use(bodyParser.urlencoded({ extended: false })) 80app.use(bodyParser.urlencoded({ extended: false }))
84// Validate some params for the API
85app.use(expressValidator({
86 customValidators: customValidators
87}))
88 81
89// ----------- Views, routes and static files ----------- 82// ----------- Views, routes and static files -----------
90 83