mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 03:57:06 +03:00
added tests and route
This commit is contained in:
@@ -29,6 +29,7 @@ import {apiCspMiddleware} from './middleware/apiCsp';
|
||||
import {rateLimitMiddleware} from './middleware/requestRateLimit';
|
||||
import dumpDatabase, {redirectLink} from './routes/dumpDatabase';
|
||||
import {endpoint as getSegmentInfo} from './routes/getSegmentInfo';
|
||||
import {postClearCache} from './routes/postClearCache';
|
||||
|
||||
export function createServer(callback: () => void) {
|
||||
// Create a service (the app object is just a callback).
|
||||
@@ -136,6 +137,9 @@ function setupRoutes(app: Express) {
|
||||
//get segment info
|
||||
app.get('/api/segmentInfo', getSegmentInfo);
|
||||
|
||||
//clear cache as VIP
|
||||
app.post('/api/clearCache', postClearCache)
|
||||
|
||||
if (config.postgres) {
|
||||
app.get('/database', (req, res) => dumpDatabase(req, res, true));
|
||||
app.get('/database.json', (req, res) => dumpDatabase(req, res, false));
|
||||
|
||||
Reference in New Issue
Block a user