2023-03-05 04:49:08 +00:00
|
|
|
import { cors, Hono } from '@/deps.ts';
|
2023-03-05 01:55:28 +00:00
|
|
|
|
2023-03-05 03:49:33 +00:00
|
|
|
import { credentialsController } from './api/accounts.ts';
|
|
|
|
import { appCredentialsController, createAppController } from './api/apps.ts';
|
|
|
|
import { emptyArrayController } from './api/fallback.ts';
|
2023-03-05 02:19:57 +00:00
|
|
|
import instanceController from './api/instance.ts';
|
2023-03-05 03:36:53 +00:00
|
|
|
import { createTokenController } from './api/oauth.ts';
|
2023-03-05 05:26:25 +00:00
|
|
|
import { createStatusController } from './api/statuses.ts';
|
2023-03-05 02:19:57 +00:00
|
|
|
|
2023-03-05 01:55:28 +00:00
|
|
|
const app = new Hono();
|
|
|
|
|
2023-03-05 04:49:08 +00:00
|
|
|
app.use('/*', cors());
|
|
|
|
|
2023-03-05 02:19:57 +00:00
|
|
|
app.get('/api/v1/instance', instanceController);
|
2023-03-05 01:55:28 +00:00
|
|
|
|
2023-03-05 03:49:33 +00:00
|
|
|
app.get('/api/v1/apps/verify_credentials', appCredentialsController);
|
2023-03-05 02:59:39 +00:00
|
|
|
app.post('/api/v1/apps', createAppController);
|
|
|
|
|
2023-03-05 03:36:53 +00:00
|
|
|
app.post('/oauth/token', createTokenController);
|
|
|
|
|
2023-03-05 03:49:33 +00:00
|
|
|
app.get('/api/v1/accounts/verify_credentials', credentialsController);
|
|
|
|
|
2023-03-05 05:26:25 +00:00
|
|
|
app.post('/api/v1/statuses', createStatusController);
|
|
|
|
|
2023-03-05 03:49:33 +00:00
|
|
|
// Not (yet) implemented.
|
|
|
|
app.get('/api/v1/timelines/*', emptyArrayController);
|
|
|
|
app.get('/api/v1/accounts/:id/statuses', emptyArrayController);
|
|
|
|
app.get('/api/v1/bookmarks', emptyArrayController);
|
|
|
|
|
2023-03-05 01:55:28 +00:00
|
|
|
export default app;
|