Commit 525483b 1 parent fb2e248 commit 525483b Copy full SHA for 525483b
File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,19 @@ import {
16
16
findRoute ,
17
17
type RouterContext ,
18
18
} from "rou3" ;
19
- import { serve , type ServerOptions } from "srvx" ;
19
+ import { serve as srvxServe , type ServerOptions } from "srvx" ;
20
20
import { getPathname , joinURL } from "./utils/internal/path" ;
21
21
import { H3WebEvent } from "./event" ;
22
22
import { kNotFound , prepareResponse } from "./response" ;
23
23
import { createError } from "./error" ;
24
24
25
+ /**
26
+ * Serve the h3 app, automatically handles current runtime behavior.
27
+ */
28
+ export function serve ( app : H3 , options ?: ServerOptions ) {
29
+ return srvxServe ( { fetch : app . fetch , ...options } ) ;
30
+ }
31
+
25
32
/**
26
33
* Create a new h3 instance.
27
34
*/
@@ -63,10 +70,6 @@ class _H3 implements H3 {
63
70
} ;
64
71
}
65
72
66
- serve ( options : ServerOptions ) {
67
- return serve ( { ...options , fetch : this . fetch } ) ;
68
- }
69
-
70
73
fetch (
71
74
_request : Request | URL | string ,
72
75
options ?: RequestInit & { h3 ?: H3EventContext } ,
Original file line number Diff line number Diff line change 2
2
export * from "./types" ;
3
3
4
4
// H3
5
- export { createH3 } from "./h3" ;
5
+ export { createH3 , serve } from "./h3" ;
6
6
7
7
// Event
8
8
export { isEvent , mockEvent } from "./utils/event" ;
You can’t perform that action at this time.
0 commit comments