This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 1
- import type { Context } from 'https://deno.land/x/[email protected] /context.ts'
2
- import type { Middleware } from 'https://deno.land/x/[email protected] /middleware.ts'
3
- import { NativeRequest } from 'https://deno.land/x/[email protected] /http_server_native.ts'
4
- import { Aleph } from './aleph.ts'
1
+ import type { Aleph } from './aleph.ts'
5
2
import { Server } from './server.ts'
6
3
7
- /** `oakify` creates an **oak** middleware for Aleph app . */
8
- export function oakify ( aleph : Aleph ) : Middleware {
4
+ /** `oakify` creates an **oak** middleware with Aleph server . */
5
+ export function oakify ( aleph : Aleph ) {
9
6
const server = new Server ( aleph )
10
7
11
- return ( ctx : Context ) => {
8
+ return ( ctx : any ) => {
12
9
const { originalRequest } = ctx . request
13
- if ( originalRequest instanceof NativeRequest ) {
10
+ if ( 'respond' in originalRequest ) {
14
11
const { request, respond } = originalRequest
15
12
server . handle ( { request, respondWith : respond } )
16
13
ctx . respond = false
17
14
} else {
18
- ctx . throw ( 500 , 'Aleph.js doesn\'t support oak `ServerRequest` yet' )
15
+ ctx . throw ( 500 , 'Aleph.js doesn\'t support std `ServerRequest` yet' )
19
16
}
20
17
}
21
18
}
You can’t perform that action at this time.
0 commit comments