diff options
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -12,7 +12,6 @@ import * as bodyParser from 'body-parser' | |||
12 | import * as express from 'express' | 12 | import * as express from 'express' |
13 | import * as http from 'http' | 13 | import * as http from 'http' |
14 | import * as morgan from 'morgan' | 14 | import * as morgan from 'morgan' |
15 | import * as path from 'path' | ||
16 | import * as bitTorrentTracker from 'bittorrent-tracker' | 15 | import * as bitTorrentTracker from 'bittorrent-tracker' |
17 | import * as cors from 'cors' | 16 | import * as cors from 'cors' |
18 | import { Server as WebSocketServer } from 'ws' | 17 | import { Server as WebSocketServer } from 'ws' |
@@ -156,20 +155,11 @@ app.use('/', activityPubRouter) | |||
156 | app.use('/', feedsRouter) | 155 | app.use('/', feedsRouter) |
157 | app.use('/', webfingerRouter) | 156 | app.use('/', webfingerRouter) |
158 | 157 | ||
159 | // Client files | ||
160 | app.use('/', clientsRouter) | ||
161 | |||
162 | // Static files | 158 | // Static files |
163 | app.use('/', staticRouter) | 159 | app.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! |
166 | app.use('/*', function (req, res) { | 162 | app.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 | ||