restapi icon indicating copy to clipboard operation
restapi copied to clipboard

Example

Open ckaminski opened this issue 1 year ago • 1 comments

Is there an example about extending handle_request?

I haven't been able to find an API I can add my own paths to the handle_request loop.

ckaminski avatar May 15 '23 19:05 ckaminski

Hello and thanks for checking out the repo!

This is a great question. Unfortunately the current design/api does not support extending or customizing the src/handle_request.rs to handle different url routes. I'll have to look around at how other hyper frameworks handle that type of support/use case. Let me know if you have any ideas too.

Since customizing the handle_request.rs is not supported for now, I would:

  1. clone the repo locally using https (or fork the repo and then clone it locally)
  2. copy over any local handle_request.rs changes you want into the newly-cloned repo's ./src/handle_request.rs file
  3. build the crate and run the server
    cargo build --example server && export RUST_BACKTRACE=1 && export RUST_LOG=info,kafka_threadpool=info && ./target/debug/examples/server
    

Hope that helps!

jay-johnson avatar May 16 '23 19:05 jay-johnson