I'm looking for an unfancy HTTP server framework

I sometimes need to write small HTTP API applications, but there are so many HTTP server frameworks to choose from. Tried one, confused and lost, and abandoned. So I'm asking here.

I want it to be simple and straight-forward. No fancy auto type conversions, no magic macros. The request handler should (e.g.) accept a request object and return a result of a response object. No fancy argument type for data extraction and no a lot of different tuples for response.

I want it to be complete. Every respect of request information is exposed, not only request headers but also the remote IP, the protocol version in use, etc. Also streaming requests and responses should be ready to use.

And sure, I want it to be async, interoperating well with other async crates.

Is there a crate just what I'm looking for?

I can't vouch for it (never used it) but a browse on lib.rs turns up snowboard and it looks like a good fit for you.

The Request struct is missing the protocol version though.

If you want more details like that you might be able to fork and add that yourself. The source looks very readable to me.

I doubt it's the fastest ever server framework or anything but it does look simple :slight_smile:

1 Like

Have you considered using hyper? It is the building block that many of the popular fancy frameworks are based on.

4 Likes

Thanks! Hyper looks very close to what I want, plus it should be able to listen on UNIX domain sockets (which is good for things like nginx). I thought hyper was very low-level but it seems to be much higher :slight_smile:

Yes, it looks close. Thanks.

Having looked at the hyper docs, and remembering that hyper is v1 now. I think hyper is probably the way to go :slight_smile: