-
Notifications
You must be signed in to change notification settings - Fork 742
Expand file tree
/
Copy pathserver.ts
More file actions
67 lines (61 loc) · 1.73 KB
/
server.ts
File metadata and controls
67 lines (61 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import type { VNode } from "preact";
import type { FreshContext } from "../context.ts";
import type { HandlerFn, RouteHandler } from "../handlers.ts";
/**
* @deprecated Use {@link PageProps} instead.
*/
export type AppProps<_Data = unknown, T = unknown> = FreshContext<T>;
/**
* @deprecated Use {@link PageProps} instead.
*/
export type LayoutProps<_Data = unknown, T = unknown> = FreshContext<T>;
/**
* @deprecated Use {@link PageProps} instead.
*/
export type UnknownPageProps<_Data = unknown, T = unknown> = FreshContext<T>;
/**
* @deprecated Use {@link PageProps} instead.
*/
export type ErrorPageProps<_Data = unknown, T = unknown> = FreshContext<T>;
/**
* @deprecated Use {@link FreshContext} instead.
*/
export type RouteContext<_T = never, S = Record<string, unknown>> =
FreshContext<S>;
/**
* @deprecated Use {@link RouteHandler} instead.
*/
// deno-lint-ignore no-explicit-any
export type Handlers<T = any, State = Record<string, unknown>> = RouteHandler<
T,
State
>;
/**
* @deprecated Use {@link HandlerFn} instead.
*/
// deno-lint-ignore no-explicit-any
export type Handler<T = any, State = Record<string, unknown>> = HandlerFn<
T,
State
>;
function defineFn<State>(
fn: (
ctx: FreshContext<State>,
) => Request | VNode | null | Promise<Request | VNode | null>,
): (
ctx: FreshContext<State>,
) => Request | VNode | null | Promise<Request | VNode | null> {
return fn;
}
/**
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
*/
export const defineApp = defineFn;
/**
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
*/
export const defineRoute = defineFn;
/**
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
*/
export const defineLayout = defineFn;