Use Rocket together with Diesel (SQLite)


My goal is quite simple; I want to use an SQLite database in Rocket. I tried various examples from Github (which were all different) and the documentation from rocket_contrib::databases, but neither of them worked for me...
Therefor I wanted to ask if you know any good, working and simple example project or tutorial with this feature that works at the current latest version of rust?
Or simpler asked: How can I expose an existing and valid database-connection (via Diesel) to each request-handler-function?

There is an example in the Rocket repo using SQLite and Diesel:

(Weirdly despite being in the examples/ directory it is a separate crate, so you have to cd examples/todo and then cargo run.)

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.