1 stable release

1.0.0 Dec 10, 2024

#13 in #cloudflare-workers

MIT license

6KB
88 lines

HTTP router for Cloudflare Workers

Example using the worker:

struct ServerState {}

async fn get_hello(_req: Request, _state: Arc<ServerState>) -> Result<Response> {
  ResponseBuilder::new().ok("hello")
}

#[event(fetch)]
async fn fetch(req: Request, _env: Env, _ctx: Context) -> Result<Response> {
  let state = Arc::new(ServerState {});
  let router = router::Router::new_with_state(state).get(router::path("/hello")?, get_hello);

  router.run(req).await
}

Dependencies

~17–27MB
~394K SLoC

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy