Is there a detailed document on making webservers in rust?

I want to write a local web server in rust that runs a complex website and I find book a little inadequate on this specific topic, is there any detailed material on making web servers in RUST?

PLEASE NO FRAMEWORKS
i want full control over my app and learning frameworks is more painful than writing stuff

1 Like

If you don't want frameworks, have a look at this page.
It lists Rust web frameworks, but also lower level pieces that you can use yourself.

2 Likes

It gave me 404 error

It’s https://www.arewewebyet.org

Studying existing web servers for design and impl ideas is something I’d recommend even if you want to build your own in the end.

3 Likes

Thanks, I fixed the link (why is the www. not purely optional for that site anyway?) now.

@hyousef I agree with what @vitalyd said, and the reason is that many of the design decisions made by the current frameworks are not arbitrary, at least not w.r.t. how to model web-related concepts using Rust (accounting for e.g. ownership and borrowing, lack of type inheritance etc).
Even if you ultimately design your own library or framework, those libs have a lot of learned lessons embedded in them.

2 Likes

The following effort (just getting underway) may be of interest to you. It talks about framework, but in a way that may still appeal to your preferences: by using and guiding a bunch of the low-level component crates into a cohesive stack.

https://rust-lang-nursery.github.io/wg-net/2018/09/11/tide.html

As for selective use: I agree, sometimes you want a featureful, integrated platform that takes care of all the plumbing so you can concentrate on your functionality layered on top, sometimes you're integrating several kinds of plumbing together into your own creation, and sometimes you just need a little watering-can.

The great thing about rust is that there are lots of differently-shaped bits of plumbing, in many different styles and patterns: async and synchronous, event- and actor-driven, application- and embedded-focused, metric and imperial sizes, brass and PVC and clear plastic pipes, hot and cold water, etc etc.

The hard thing about rust is that there are lots of differently-shaped bits of plumbing. If you know what you're looking for, the arewewebyet page might help you find it. The tide effort is about building something useful and encouraging interoperability standards and patterns among them for the future.

If all that is too much, and you're looking for a low-level HTTP parsing and request/response library to build your own thing, take a look at hyper. It is the basis for many of the others, taking care of some of the minutia of http parsing and protocol so you can use it how you like: for a really simple and small server, for embedding a web-based admin or monitoring UI in another program, or just a place to start learning and building.

2 Likes

It's .org, not .com

1 Like