How would you architect this use-case

8 views
Skip to first unread message

Morkor

unread,
May 26, 2018, 1:22:56 PM5/26/18
to Angular and AngularJS discussion
Hello.


I have a node typescript back-end.

I am trying to build an angular application, following SOLID principles.


I am wondering, how would you architect logic based around http calls. This is how I did for the fonctionality below

User Login processus:
  • UserHttpClient performs JWT request on back-end
    • Is placed next to a JwtRegisterRequestBody, and a JwtRegisterResponse, which are copies of what back-end waits for / returns.
  • UserConnector, calls UserHttpClient to send the request, then register user in application state
    • Waits for a UserLogin, which is a class with username/password fields (just as my JwtRegisterRequestBody)
  • UserLoginComponent presents the form and uses UserLogin as form data.
    • Will call UserConnector to connect

This seems strongly use-case-typed and therefore flexible to any particularity i would encounter. Like having to add a field in UserLogin which would be unnecessary for the back-end. 


What do you think about this ? Would you do it (for every http call you will have to make), otherwise how would you architect it ? 

I am also thinking that in my processes, I could get ride of the custom HttpClient, and build something generic. If it doesn't present too much cons.

Thank you,

(Also, version 6 of Angular used)

Reply all
Reply to author
Forward
0 new messages