Replies: 1 comment 1 reply
-
Looking for that feature too |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I'm a beginner to Rust and I'm struggling a lot trying to design a layered application using some patterns like having
Services
for business logic andRepositories
for data access, I would love some help to understand what I'm doing wrong.So far I have:
user/controller.rs
user/service.rs
user/repository.rs
user/model.rs
UserService
andUserRepository
arestructs
with methods.UserService
has an instance of aUserRepository
, which has an instance of a database pool manager. I'm instantiating all those things in mymain
function and wrapping theUserService
usingweb::Data
and passing it to theApplication State
, in order to access it inside myrequest handlers
, but I simply can't get it to work.I put all the source code in this repo, with all the instructions to start the app: https://github.com/refl3ction/rust-api
I'm currently stuck in the
UserController::create_user
function, in which I can't get theUserService
from Application state.Appreciate some help 🙏
Beta Was this translation helpful? Give feedback.
All reactions