http w/o axum

Alright, got it working:
use http::{Response, StatusCode};
use worker::{event, Context, Env, HttpRequest};

#[event(fetch)]
async fn fetch(
_req: HttpRequest,
_env: Env,
_ctx: Context,
) -> worker::Result<http::Response<String>> {
let response = Response::builder()
.status(StatusCode::OK)
.body("Hello from http".to_string())
.unwrap();
Ok(response)
}
use http::{Response, StatusCode};
use worker::{event, Context, Env, HttpRequest};

#[event(fetch)]
async fn fetch(
_req: HttpRequest,
_env: Env,
_ctx: Context,
) -> worker::Result<http::Response<String>> {
let response = Response::builder()
.status(StatusCode::OK)
.body("Hello from http".to_string())
.unwrap();
Ok(response)
}
3 Replies
dakom
dakom6mo ago
working on porting over... is there a reason that Result<HttpResponse> isn't the right thing? heh, set the thread title instead of msg what I meant to say - is there a reason not to return HttpResponse ?
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
dakom
dakom6mo ago
hmm, interesting!
Want results from more Discord servers?
Add your server