January 2019
Intermediate to advanced
520 pages
14h 32m
English
To start a server instance, we have to prepare a database interaction. But it doesn't work directly as it did with the diesel crate. To connect a database, we have to add the crates we need and activate the necessary features of the rocket_contrib crate:
rocket = "0.4.0-rc.1"rocket_contrib = { version = "0.4.0-rc.1", features = ["diesel_sqlite_pool"] }serde = "1.0"serde_json = "1.0"serde_derive = "1.0"diesel = { version = "1.3", features = ["sqlite", "r2d2"] }diesel_migrations = "1.3"log = "0.4"
We used the diesel_sqlite_pool feature of the rocket_contrib crate and sqlite with r2d2 from the diesel crate. The following lines of code import macros from all of the crates we need, add the comment module that we will create ...
Read now
Unlock full access