I have angular2 app. I'd like to put authentication logic as a separate application.
Reasons of separating:
It looks like routing is the main problem.
How to organize splitting routes between applications?
/signin and /signup links should redirect to authentication app.
When /customers link should redirect to main app.
If you want different application (running as separate web app) the routing should happen in the web server and not in the application, so the redirection should point to the different index.htmls... But this really depends on your environment, express, IIS, etc
If you just would like to split the code than you can create a different module for Authentication and reference it from you app as any other node modules. In this case if you don't want to load the code immediately you can use the dynamic component loader in angular2 to load the code in demand (this almost as separate app).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With