Responder
Easy to use, easy to set up. Here's an example of a simple web-server
use *;
Simple, isn't it? Now where and how do I handle all my requests?
The Stream and Respond structs help you manage incoming requests as well as providing you many options for building http-responses.
---> Stream
The Stream struct is passed as a parameter to every endpoint-function. It contains valuable information, together with salient methods for your needs. Here's an exaple of an endpoint function utilizing the features of the Stream struct:
/* Will respond with the http-status code 200 */
---> Respond
The Respond struct is used to construct HTTP responses. It's mostly constructed using the "builder pattern". Here's one example of how it could be used:
/* Will respond with some text */
Security 🚨
Now that we've covered the basics of responder, we'll shortly dig into the security. Rust, by default is secure. Therefore we don't need to be worried about memory leaks and more. However, that won't stop people from getting access to restricted endpoints. responder has a solution for that. It's called origin-control. It's an enum variant in the Route struct named ControlledStack, and it's main purpose is to check wether the incoming request meets some criteria, and then either ditch the request, or grant it access to the inner endpoints. Here's an example of how you could do that:
let routes = &;
/* Create the origin control function */