aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts14
1 files changed, 2 insertions, 12 deletions
diff --git a/server.ts b/server.ts
index bdcbb7988..c0e679b02 100644
--- a/server.ts
+++ b/server.ts
@@ -12,7 +12,6 @@ import * as bodyParser from 'body-parser'
12import * as express from 'express' 12import * as express from 'express'
13import * as http from 'http' 13import * as http from 'http'
14import * as morgan from 'morgan' 14import * as morgan from 'morgan'
15import * as path from 'path'
16import * as bitTorrentTracker from 'bittorrent-tracker' 15import * as bitTorrentTracker from 'bittorrent-tracker'
17import * as cors from 'cors' 16import * as cors from 'cors'
18import { Server as WebSocketServer } from 'ws' 17import { Server as WebSocketServer } from 'ws'
@@ -156,20 +155,11 @@ app.use('/', activityPubRouter)
156app.use('/', feedsRouter) 155app.use('/', feedsRouter)
157app.use('/', webfingerRouter) 156app.use('/', webfingerRouter)
158 157
159// Client files
160app.use('/', clientsRouter)
161
162// Static files 158// Static files
163app.use('/', staticRouter) 159app.use('/', staticRouter)
164 160
165// Always serve index client page (the client is a single page application, let it handle routing) 161// Client files, last valid routes!
166app.use('/*', function (req, res) { 162app.use('/', clientsRouter)
167 if (req.accepts(ACCEPT_HEADERS) === 'html') {
168 return res.sendFile(path.join(__dirname, '../client/dist/index.html'))
169 }
170
171 return res.status(404).end()
172})
173 163
174// ----------- Errors ----------- 164// ----------- Errors -----------
175 165