Add /api not implemented controller

This commit is contained in:
Alex Gleason 2023-09-11 04:55:15 -05:00
parent a5bf09ed2b
commit bacb872a18
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 2 deletions

View File

@ -29,7 +29,7 @@ import {
verifyCredentialsController,
} from './controllers/api/accounts.ts';
import { appCredentialsController, createAppController } from './controllers/api/apps.ts';
import { emptyArrayController, emptyObjectController } from './controllers/api/fallback.ts';
import { emptyArrayController, emptyObjectController, notImplementedController } from './controllers/api/fallback.ts';
import { instanceController } from './controllers/api/instance.ts';
import { mediaController } from './controllers/api/media.ts';
import { notificationsController } from './controllers/api/notifications.ts';
@ -157,6 +157,8 @@ app.get('/api/v1/markers', emptyObjectController);
app.get('/api/v1/conversations', emptyArrayController);
app.get('/api/v1/lists', emptyArrayController);
app.use('/api/*', notImplementedController);
app.get('*', serveStatic({ root: './public/' }));
app.get('*', serveStatic({ path: './public/index.html' }));

View File

@ -2,5 +2,6 @@ import type { Context } from '@/deps.ts';
const emptyArrayController = (c: Context) => c.json([]);
const emptyObjectController = (c: Context) => c.json({});
const notImplementedController = (c: Context) => Promise.resolve(c.json({ error: 'Not implemented' }, 404));
export { emptyArrayController, emptyObjectController };
export { emptyArrayController, emptyObjectController, notImplementedController };