Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular authentication logic as separate application

I have angular2 app. I'd like to put authentication logic as a separate application.

Reasons of separating:

  1. Login / Sing up views have completely different design. Even on body level.
  2. Login view should not load all sources of main application.
  3. I'd like to show the first view very fast.

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.

like image 872
rnofenko Avatar asked Jun 18 '26 05:06

rnofenko


1 Answers

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).

like image 186
eesdil Avatar answered Jun 19 '26 18:06

eesdil