Hello all,
Fabrice, Thank you very much for your opinion.
I totally agree with you that if we don't place right things in right place on right time then it would be a nightmare for me and my project.
We have to design it properly and use existing tools wisely.
I agree I am new to this tech stack and I have to learn a lot of things before I write a single line of code but please understand my situation here, I have to start somewhere even I know I might fail I have to start.
I might do wrong things but I am ready to put my efforts to correct/refactor it.
I am not new to the functional programming languages I worked on Clojure before. So Scala is not my problem right now. I have also worked on similar stack.
We are in a very beginning phase of the project and we think Lagom suits the most for our business requirement.
So anyways I have to work it out. :)
Here before what I have implemented is a simple React+Redux based login page and an auth API implementation using Lagom inside front-end module for now (which should be another module).
UI app runs on 3000 port and backend is at 9000 port.
When I hit the API for the first time it gave me 415 (Unsupported Media Type) so I added a content-type header with values application/jsoen.
But when I hit this POST API using ajax it automatically makes a method type OPTION instead of POST (which is a preflight request and might be because of cors). A simple GET requests works.
So I came to the point that I have to allow origin. But where? Backend Lagom side or on Nginx. As I mentioned before my UI code will not be part of front-end module and will be served from Nginx (For local development I am using webpack server).
I guess we can resolve this thing by allowing origin at backend or we can use proxying to the backend from frontend server (Nginx)
In my case, I am going to choose the second option. The reason behind this is I can put front-end app in public subnet and backend in private subnet which becomes more secure. So Nginx is the only one who can have access to these services.
It is easy to add proxy inside Nginx for production but right now we are in development and we are using either of webpack-dev-server, express or browser-sync.
It would be very helpful if you guys give me some links for architectural design or some well define GitHub projects link.
Thank you again!
DheerajK