Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit b7918ad

Browse files
committed
Remove oak types dep
1 parent ddd783f commit b7918ad

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

server/oak.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
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'
52
import { Server } from './server.ts'
63

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) {
96
const server = new Server(aleph)
107

11-
return (ctx: Context) => {
8+
return (ctx: any) => {
129
const { originalRequest } = ctx.request
13-
if (originalRequest instanceof NativeRequest) {
10+
if ('respond' in originalRequest) {
1411
const { request, respond } = originalRequest
1512
server.handle({ request, respondWith: respond })
1613
ctx.respond = false
1714
} 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')
1916
}
2017
}
2118
}

0 commit comments

Comments
 (0)