rethinkdb / rethinkdb-rs

A native RethinkDB driver written in Rust
Apache License 2.0
210 stars 27 forks source link

How to integrate reql in Actix web? #32

Closed ghost closed 6 years ago

rushmorem commented 6 years ago

Currently, reql is designed in a way that makes it very easy to integrate with any framework. The only object that needs to be passed around is the Connection. However, it doesn't carry the connection pool, itself. It only carries its ID, so it's very small. Because of that it implements Copy.

In Actix, like in any other framework, you should initiliase the connection in your main function to get the connection object. You can then copy the object around as app state, using App::with_state. See this example.

ghost commented 6 years ago

@rushmorem thnx!~

rushmorem commented 6 years ago

My pleasure.