mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
21 lines
626 B
TypeScript
21 lines
626 B
TypeScript
import { Hono } from '@hono/hono';
|
|
|
|
import type { HonoOptions } from '@hono/hono/hono-base';
|
|
import type { DittoEnv } from './DittoEnv.ts';
|
|
|
|
export class DittoApp extends Hono<DittoEnv> {
|
|
// @ts-ignore Require a DittoRoute for type safety.
|
|
declare route: (path: string, app: Hono<DittoEnv>) => Hono<DittoEnv>;
|
|
|
|
constructor(vars: Omit<DittoEnv['Variables'], 'signal'>, opts: HonoOptions<DittoEnv> = {}) {
|
|
super(opts);
|
|
|
|
this.use((c, next) => {
|
|
c.set('db', vars.db);
|
|
c.set('conf', vars.conf);
|
|
c.set('store', vars.store);
|
|
c.set('signal', c.req.raw.signal);
|
|
return next();
|
|
});
|
|
}
|
|
}
|