added tests and route

This commit is contained in:
Michael C
2021-06-18 17:46:18 -04:00
parent 04da532962
commit c13bc6cfbd
3 changed files with 79 additions and 3 deletions

View File

@@ -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));