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
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.
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.
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.
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.
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.