File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default {
99 request : Request ,
1010 env : Env ,
1111 ) : Promise < Response > {
12- return await server
12+ return await server ( )
1313 . handle ( request )
1414 } ,
1515 async scheduled (
Original file line number Diff line number Diff line change 11import cors from "@elysiajs/cors" ;
22import serverTiming from "@elysiajs/server-timing" ;
3+ import { env } from 'cloudflare:workers' ;
34import Elysia from "elysia" ;
4- import { CloudflareAdapter } from "elysia/adapter/cloudflare-worker" ;
55import { createSetupPlugin } from "./setup" ;
6- import { env } from 'cloudflare:workers'
76
8- const basePlugin = new Elysia ( {
7+ const basePlugin = ( ) => new Elysia ( {
98 name : "base-plugin" ,
10- adapter : CloudflareAdapter
119} )
1210 . use ( cors ( {
1311 aot : false ,
@@ -24,9 +22,9 @@ const basePlugin = new Elysia({
2422 . use ( serverTiming ( {
2523 enabled : true ,
2624 } ) )
27- . use ( createSetupPlugin ( env ) )
2825
2926export default ( ) => new Elysia ( {
30- adapter : CloudflareAdapter
27+ aot : false
3128} )
32- . use ( basePlugin )
29+ . use ( basePlugin ( ) )
30+ . use ( createSetupPlugin ( env ) )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import { TagService } from './services/tag';
1313import { UserService } from './services/user' ;
1414
1515
16- const app = base ( )
16+ const app = ( ) => base ( )
1717 . use ( UserService )
1818 . use ( FaviconService )
1919 . use ( FeedService )
@@ -31,7 +31,6 @@ const app = base()
3131 if ( code === 'NOT_FOUND' )
3232 return `${ path } ${ JSON . stringify ( params ) } not found`
3333 } )
34- . compile ( )
3534
3635
3736export default app
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { CacheImpl } from "./utils/cache";
77import { drizzle } from "drizzle-orm/d1" ;
88import * as schema from './db/schema' ;
99import { createOAuthPlugin , GitHubProvider } from "./utils/oauth" ;
10+ import { CloudflareAdapter } from "elysia/adapter/cloudflare-worker" ;
1011
1112
1213const anyUser = async ( db : DB ) => ( await db . query . users . findMany ( ) ) ?. length > 0
@@ -47,7 +48,9 @@ export function createSetupPlugin(env: Env) {
4748 } ) ,
4849 } ) ;
4950
50- return new Elysia ( )
51+ return new Elysia ( {
52+ name : 'plugins' ,
53+ } )
5154 . state ( 'db' , db )
5255 . state ( 'env' , env )
5356 . state ( 'cache' , cache )
You can’t perform that action at this time.
0 commit comments