mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Add /api not implemented controller
This commit is contained in:
parent
a5bf09ed2b
commit
bacb872a18
2 changed files with 5 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ import {
|
||||||
verifyCredentialsController,
|
verifyCredentialsController,
|
||||||
} from './controllers/api/accounts.ts';
|
} from './controllers/api/accounts.ts';
|
||||||
import { appCredentialsController, createAppController } from './controllers/api/apps.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 { instanceController } from './controllers/api/instance.ts';
|
||||||
import { mediaController } from './controllers/api/media.ts';
|
import { mediaController } from './controllers/api/media.ts';
|
||||||
import { notificationsController } from './controllers/api/notifications.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/conversations', emptyArrayController);
|
||||||
app.get('/api/v1/lists', emptyArrayController);
|
app.get('/api/v1/lists', emptyArrayController);
|
||||||
|
|
||||||
|
app.use('/api/*', notImplementedController);
|
||||||
|
|
||||||
app.get('*', serveStatic({ root: './public/' }));
|
app.get('*', serveStatic({ root: './public/' }));
|
||||||
app.get('*', serveStatic({ path: './public/index.html' }));
|
app.get('*', serveStatic({ path: './public/index.html' }));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@ import type { Context } from '@/deps.ts';
|
||||||
|
|
||||||
const emptyArrayController = (c: Context) => c.json([]);
|
const emptyArrayController = (c: Context) => c.json([]);
|
||||||
const emptyObjectController = (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 };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue