single-spa-login-example-with-npm-packages
Single-spa application example which imports registered applications from NPM packages and manages authentication features as login.
✍🏻 Motivation
This application is a little demo of how you can use single-spa splitting code with Option 2: NPM packages
▶️ Demo
You can see a working demo of this application in the next link: https://single-spa-with-npm-packages.herokuapp.com.
The login validation is harcoded in code and the credentials are:
User | Password |
---|---|
admin | 12345 |
💻 Run in localhost
If you prefer run this application in localhost you must follow next steps:
npm install
npm run serve
Finally you only have to open http://localhost:8080 in a browser to see the app running
single-spa applications
This application is a root-application that inits a single-spa application that integrates two registered applications:
🔐 single-spa-auth-app
This application is displayed by default as there is no logged in user. A login form is printed and the credentials can be set for perform the login and access to the private views.
🧱 single-spa-layout-app
This application contains topbar and sidebar menus, navigation between registered applications and /login redirection if logout link is clicked or token is removed from sessionStorage.