fbr gone
parent
80c5863e0b
commit
51e79b7b50
@ -1,7 +1,6 @@
|
|||||||
import Elysia from "elysia";
|
import Elysia from "elysia";
|
||||||
import { todosService as todosController } from "./todos";
|
import { todosController } from "./todos";
|
||||||
|
|
||||||
export const api = new Elysia({
|
export const api = new Elysia({
|
||||||
name: "@app/api",
|
|
||||||
prefix: "/api",
|
prefix: "/api",
|
||||||
}).use(todosController);
|
}).use(todosController);
|
@ -1 +0,0 @@
|
|||||||
import Html from "@kitajs/html";
|
|
@ -0,0 +1,73 @@
|
|||||||
|
import type {
|
||||||
|
DecoratorBase,
|
||||||
|
DefinitionBase,
|
||||||
|
Handler,
|
||||||
|
InputSchema,
|
||||||
|
LocalHook,
|
||||||
|
MergeSchema,
|
||||||
|
RouteBase,
|
||||||
|
RouteSchema,
|
||||||
|
UnwrapRoute,
|
||||||
|
} from "elysia/types";
|
||||||
|
import { type Elysia, t } from "elysia";
|
||||||
|
|
||||||
|
type RouteArgs<
|
||||||
|
BasePath extends string,
|
||||||
|
Decorators extends DecoratorBase,
|
||||||
|
Definitions extends DefinitionBase,
|
||||||
|
ParentSchema extends RouteSchema,
|
||||||
|
Routes extends RouteBase,
|
||||||
|
Path extends string,
|
||||||
|
LocalSchema extends InputSchema<keyof Definitions["type"] & string>,
|
||||||
|
Route extends MergeSchema<
|
||||||
|
UnwrapRoute<LocalSchema, Definitions["type"]>,
|
||||||
|
ParentSchema
|
||||||
|
>,
|
||||||
|
Function extends Handler<Route, Decorators, `${BasePath}${Path}`>
|
||||||
|
> = {
|
||||||
|
handler: Function;
|
||||||
|
hooks?: LocalHook<
|
||||||
|
LocalSchema,
|
||||||
|
Route,
|
||||||
|
Decorators,
|
||||||
|
Definitions["error"],
|
||||||
|
`${BasePath}${Path}`
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function elysiaHandler<
|
||||||
|
BasePath extends string,
|
||||||
|
Decorators extends DecoratorBase,
|
||||||
|
Definitions extends DefinitionBase,
|
||||||
|
ParentSchema extends RouteSchema,
|
||||||
|
Routes extends RouteBase,
|
||||||
|
Path extends string,
|
||||||
|
LocalSchema extends InputSchema<keyof Definitions["type"] & string>,
|
||||||
|
Route extends MergeSchema<
|
||||||
|
UnwrapRoute<LocalSchema, Definitions["type"]>,
|
||||||
|
ParentSchema
|
||||||
|
>,
|
||||||
|
Function extends Handler<Route, Decorators, `${BasePath}${Path}`>
|
||||||
|
>(
|
||||||
|
elysiaInstance: Elysia<
|
||||||
|
BasePath,
|
||||||
|
Decorators,
|
||||||
|
Definitions,
|
||||||
|
ParentSchema,
|
||||||
|
Routes
|
||||||
|
>,
|
||||||
|
path: Path,
|
||||||
|
obj: RouteArgs<
|
||||||
|
BasePath,
|
||||||
|
Decorators,
|
||||||
|
Definitions,
|
||||||
|
ParentSchema,
|
||||||
|
Routes,
|
||||||
|
Path,
|
||||||
|
LocalSchema,
|
||||||
|
Route,
|
||||||
|
Function
|
||||||
|
>
|
||||||
|
) {
|
||||||
|
return obj;
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
import Elysia from "elysia";
|
||||||
|
import { index } from "./index";
|
||||||
|
|
||||||
|
export const pages = new Elysia().use(index);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue