Application state
Overview
The main reason Tuono is fast is that it loads just the features that are needed for the project.
To define them, you need to fill the ApplicationState
struct in the ./src/app.rs
file, and
they will be automatically available in all the handlers you will define across the application.
For simplicity, we’re using a
String
here, but you can add database connections or HTTP clients. Check out the API fetching tutorial for an example with an HTTP client.
Now the ApplicationState
is available on all the handlers as following: