SlideShare a Scribd company logo
How to Build a Micro-Application
using Single-Spa
By,
Shwetha Thomas, Senior Software Engineer
How to Build a Micro-Application using Single-Spa
© RapidValue Solutions 2
How to Create a Micro-Application using Single-Spa
Following are the steps to create a micro-application:
● Create an angular application with a unique prefix.
ng new --prefix app1
● Enter the command ng add single-spa-angular in our project which in turn will do the
following:
- Install single-spa-angular
- Generates a main.single-spa.ts in our project src/.
- Generates single-spa-props.ts in src/single-spa/
- Generates asset-url.ts in src/single-spa/
- Generates an EmptyRouteComponent in src/app/empty-route/, to be used in app-
routing.module.ts.
- Add an npm script npm run build:single-spa.
- Add an npm script npm run serve:single-spa.
● Install custom-webpack as dev dependency(npm install -D @angular-builders/custom-
webpack@9.1.0)
● Add providers: [{provide: APP_BASE_HREF, useValue: '/'}] to app-routing.module.ts
● Add {path: '**', component: EmptyRouteComponent} to our app-routing.module.ts routes.
● Add a declaration for EmptyRouteComponent in app.module.ts
● Register the micro-app in the index.html file and call single-spa.start() function.
For example,
How to Build a Micro-Application using Single-Spa
© RapidValue Solutions 3
Figure 1: Import single-spa
Here, we are using import maps to set the path for our micro-app. student is the micro app here
which we are registering. Since we are running locally, the localhosturl is given. Once we deploy
the micro app, we can replace local url by giving the deployed url. main.js is a javascript file with the
webpack which is created while running the app. While building the app, main-es2015.js file is
created in the dist folder with the webpack.
Figure 2: Register application
This script tag is given inside the body. Here we are registering the micro-app and then calling the
singleSpa.start(). In this example, the function returns true, which means the app will be loaded by
default. We can also specify a route, so the micro-app will be mounted only on calling the specific
route.
If the function returns, location.pathname.startsWith(‘/student’); student micro-app will be
loaded only on calling /student.
There are some script tags, which is needed on loading micro-apps which are given below:
<script src='https://unpkg.com/core-js-bundle@3.1.4/minified.js'></script>
How to Build a Micro-Application using Single-Spa
© RapidValue Solutions 4
<script src="https://unpkg.com/zone.js"></script>
<script src="https://unpkg.com/import-map-overrides@1.6.0/dist/import-map-overrides.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/system.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/extras/amd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/extras/named-exports.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/extras/named-
register.min.js"></script>
Make sure each micro-app runs in a different port locally.
Serving a Micro-Application
To serve a micro-application, run the following command:
npm run serve:single-spa
For angular version greater than 9, app name will be appended to this command. Check the
package.json to know the exact command.
For example,
npm run serve:single-spa:app
Building a Micro-Application
.To build a micro-application, run the following command:
npm run build:single-spa
For angular version greater than 9, app name will be appended to this command. Check the
package.json to know the exact command.
How to Build a Micro-Application using Single-Spa
© RapidValue Solutions 5
For example,
npm run build:single-spa:app
This will create a dist folder.
How to Register the Micro-Apps into the Portal
We can load any number of micro-apps in a single application which is the portal. To create a portal application, we
need an HTML file where we can register our micro-apps and call singleSpa.start().
To register a micro-app into the portal,
● We must specify the main.js path of the micro-app in the portal
● Add the required scripts
● Register the micro-application
● Call singleSpa.start()
Take a look at the images given below for a better understanding.
Figure 1: Specify main.js path
How to Build a Micro-Application using Single-Spa
© RapidValue Solutions 6
Figure 2: Register micro-app and call start method
This part is the same as registering a micro-app to itself.
Following the above-mentioned steps ensures that the process of building and registering micro-applications in the
portal is as seamless as possible.
How to Build a Micro-Application using Single-Spa
© RapidValue Solutions 7
About RapidValue
RapidValue is a global leader in providing digital product engineering solutions including Mobility, Cloud,
Omni-channel, IoT and RPA to enterprises worldwide. RapidValue offers its digital services to the world’s
top brands, Fortune 1000 companies, and innovative emerging start-ups. With offices in the United
States, the United Kingdom, Germany, and India and operations spread across the Middle-East, Europe,
and Canada, RapidValue delivers enterprise service and solutions across various industry verticals.
Disclaimer:
This document contains information that is confidential and proprietary to RapidValue Solutions Inc. No part of it may be used,
circulated, quoted, or reproduced for distribution outside RapidValue. If you are not the intended recipient of this report, you are
hereby notified that the use, circulation, quoting, or reproducing of this report is strictly prohibited and may be unlawful.
© RapidValue Solutions
www.rapidvaluesolutions.com/blog
www.rapidvaluesolutions.com
+1 877.643.1850 contactus@rapidvaluesolutions.com

More Related Content

What's hot

TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for Microservices
VMware Tanzu
 
TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015
DotNetCampus
 
Extending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud FoundryExtending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud Foundry
Kenny Bastani
 
Running Spring Boot in Kubernetes and Intro to Helm
Running Spring Boot in Kubernetes and Intro to HelmRunning Spring Boot in Kubernetes and Intro to Helm
Running Spring Boot in Kubernetes and Intro to Helm
Carlos E. Salazar
 
Bootiful Azure Spring Cloud
Bootiful Azure Spring CloudBootiful Azure Spring Cloud
Bootiful Azure Spring Cloud
VMware Tanzu
 
Adapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at GoogleAdapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at Google
Apigee | Google Cloud
 
Introduction To Micro Frontends
Introduction To Micro Frontends Introduction To Micro Frontends
Introduction To Micro Frontends
Meitar Karas
 
Make Spring Home (Spring Customization and Extensibility)
Make Spring Home (Spring Customization and Extensibility)Make Spring Home (Spring Customization and Extensibility)
Make Spring Home (Spring Customization and Extensibility)
VMware Tanzu
 
Santosh Shukla-microservices-java-spring boot
Santosh Shukla-microservices-java-spring bootSantosh Shukla-microservices-java-spring boot
Santosh Shukla-microservices-java-spring boot
SantoshShukla46
 
Firebase
FirebaseFirebase
Firebase
neha nasreen
 
BENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICS
BENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICSBENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICS
BENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICS
brtechnosoft2018
 
Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas?
 Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas? Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas?
Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas?
VMware Tanzu
 
Breaking Down the Monolith - Peter Marton, RisingStack
Breaking Down the Monolith - Peter Marton, RisingStackBreaking Down the Monolith - Peter Marton, RisingStack
Breaking Down the Monolith - Peter Marton, RisingStack
NodejsFoundation
 
A Starters Guide to Building APIs with Javascript
A Starters Guide to Building APIs with JavascriptA Starters Guide to Building APIs with Javascript
A Starters Guide to Building APIs with Javascript
All Things Open
 
Back your app with MySQL and Redis on Cloud Foundry
Back your app with MySQL and Redis on Cloud FoundryBack your app with MySQL and Redis on Cloud Foundry
Back your app with MySQL and Redis on Cloud Foundry
Kenny Bastani
 
Test Automation Workshop with BDD Approach
Test Automation Workshop with BDD ApproachTest Automation Workshop with BDD Approach
Test Automation Workshop with BDD Approach
kloia
 
DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...
DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...
DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...
DevSecCon
 
Scaling with Microservices
Scaling with MicroservicesScaling with Microservices
Scaling with Microservices
kloia
 
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
WSO2
 
Integrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an HourIntegrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an Hour
VMware Tanzu
 

What's hot (20)

TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for Microservices
 
TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015
 
Extending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud FoundryExtending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud Foundry
 
Running Spring Boot in Kubernetes and Intro to Helm
Running Spring Boot in Kubernetes and Intro to HelmRunning Spring Boot in Kubernetes and Intro to Helm
Running Spring Boot in Kubernetes and Intro to Helm
 
Bootiful Azure Spring Cloud
Bootiful Azure Spring CloudBootiful Azure Spring Cloud
Bootiful Azure Spring Cloud
 
Adapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at GoogleAdapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at Google
 
Introduction To Micro Frontends
Introduction To Micro Frontends Introduction To Micro Frontends
Introduction To Micro Frontends
 
Make Spring Home (Spring Customization and Extensibility)
Make Spring Home (Spring Customization and Extensibility)Make Spring Home (Spring Customization and Extensibility)
Make Spring Home (Spring Customization and Extensibility)
 
Santosh Shukla-microservices-java-spring boot
Santosh Shukla-microservices-java-spring bootSantosh Shukla-microservices-java-spring boot
Santosh Shukla-microservices-java-spring boot
 
Firebase
FirebaseFirebase
Firebase
 
BENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICS
BENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICSBENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICS
BENEFIT OF FLUTTER APP DEVELOPMENT - INFOGRAPHICS
 
Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas?
 Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas? Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas?
Pivotal Cloud Foundry et Microsoft: Pourquoi? ... Et pourquoi pas?
 
Breaking Down the Monolith - Peter Marton, RisingStack
Breaking Down the Monolith - Peter Marton, RisingStackBreaking Down the Monolith - Peter Marton, RisingStack
Breaking Down the Monolith - Peter Marton, RisingStack
 
A Starters Guide to Building APIs with Javascript
A Starters Guide to Building APIs with JavascriptA Starters Guide to Building APIs with Javascript
A Starters Guide to Building APIs with Javascript
 
Back your app with MySQL and Redis on Cloud Foundry
Back your app with MySQL and Redis on Cloud FoundryBack your app with MySQL and Redis on Cloud Foundry
Back your app with MySQL and Redis on Cloud Foundry
 
Test Automation Workshop with BDD Approach
Test Automation Workshop with BDD ApproachTest Automation Workshop with BDD Approach
Test Automation Workshop with BDD Approach
 
DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...
DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...
DevSecCon London 2019: Workshop: Cloud Agnostic Security Testing with Scout S...
 
Scaling with Microservices
Scaling with MicroservicesScaling with Microservices
Scaling with Microservices
 
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
 
Integrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an HourIntegrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an Hour
 

Similar to How to Build a Micro-Application using Single-Spa

Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
Aeshan Wijetunge
 
How to implement Micro-frontends using Qiankun
How to implement Micro-frontends using QiankunHow to implement Micro-frontends using Qiankun
How to implement Micro-frontends using Qiankun
Fibonalabs
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
Ritwik Das
 
Kraken.js Lab Primer
Kraken.js Lab PrimerKraken.js Lab Primer
Kraken.js Lab Primer
Aeshan Wijetunge
 
How React Native has changed Web and Mobile Application Development, Engineer...
How React Native has changed Web and Mobile Application Development, Engineer...How React Native has changed Web and Mobile Application Development, Engineer...
How React Native has changed Web and Mobile Application Development, Engineer...
engineermaste solution
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
Sapna Upreti
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
Mean stack Magics
Mean stack MagicsMean stack Magics
Mean stack Magics
Aishura Aishu
 
The web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - IstanbulThe web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
Meteor
MeteorMeteor
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
Suresh Patidar
 
Sam segal resume
Sam segal resumeSam segal resume
Sam segal resume
samuel segal
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
Concetto Labs
 
WordCamp Bucharest 2017
WordCamp Bucharest 2017WordCamp Bucharest 2017
WordCamp Bucharest 2017
Alexandra Anghel
 
Business Utility Application
Business Utility ApplicationBusiness Utility Application
Business Utility Application
IRJET Journal
 
Fastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS AppsFastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS Apps
Sarath C
 
Codename one
Codename oneCodename one
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
Mbakaya Kwatukha
 
Easy Step-by-Step Guide to Develop REST APIs with Django REST Framework
Easy Step-by-Step Guide to Develop REST APIs with Django REST FrameworkEasy Step-by-Step Guide to Develop REST APIs with Django REST Framework
Easy Step-by-Step Guide to Develop REST APIs with Django REST Framework
Inexture Solutions
 
The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...
Robert Nyman
 

Similar to How to Build a Micro-Application using Single-Spa (20)

Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
How to implement Micro-frontends using Qiankun
How to implement Micro-frontends using QiankunHow to implement Micro-frontends using Qiankun
How to implement Micro-frontends using Qiankun
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
Kraken.js Lab Primer
Kraken.js Lab PrimerKraken.js Lab Primer
Kraken.js Lab Primer
 
How React Native has changed Web and Mobile Application Development, Engineer...
How React Native has changed Web and Mobile Application Development, Engineer...How React Native has changed Web and Mobile Application Development, Engineer...
How React Native has changed Web and Mobile Application Development, Engineer...
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
 
Mean stack Magics
Mean stack MagicsMean stack Magics
Mean stack Magics
 
The web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - IstanbulThe web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - Istanbul
 
Meteor
MeteorMeteor
Meteor
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
Sam segal resume
Sam segal resumeSam segal resume
Sam segal resume
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 
WordCamp Bucharest 2017
WordCamp Bucharest 2017WordCamp Bucharest 2017
WordCamp Bucharest 2017
 
Business Utility Application
Business Utility ApplicationBusiness Utility Application
Business Utility Application
 
Fastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS AppsFastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS Apps
 
Codename one
Codename oneCodename one
Codename one
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Easy Step-by-Step Guide to Develop REST APIs with Django REST Framework
Easy Step-by-Step Guide to Develop REST APIs with Django REST FrameworkEasy Step-by-Step Guide to Develop REST APIs with Django REST Framework
Easy Step-by-Step Guide to Develop REST APIs with Django REST Framework
 
The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...
 

More from RapidValue

Play with Jenkins Pipeline
Play with Jenkins PipelinePlay with Jenkins Pipeline
Play with Jenkins Pipeline
RapidValue
 
Accessibility Testing using Axe
Accessibility Testing using AxeAccessibility Testing using Axe
Accessibility Testing using Axe
RapidValue
 
Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in Kotlin
RapidValue
 
Automation in Digital Cloud Labs
Automation in Digital Cloud LabsAutomation in Digital Cloud Labs
Automation in Digital Cloud Labs
RapidValue
 
Microservices Architecture - Top Trends & Key Business Benefits
Microservices Architecture -  Top Trends & Key Business BenefitsMicroservices Architecture -  Top Trends & Key Business Benefits
Microservices Architecture - Top Trends & Key Business Benefits
RapidValue
 
Uploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADIUploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADI
RapidValue
 
Appium Automation with Kotlin
Appium Automation with KotlinAppium Automation with Kotlin
Appium Automation with Kotlin
RapidValue
 
Build UI of the Future with React 360
Build UI of the Future with React 360Build UI of the Future with React 360
Build UI of the Future with React 360
RapidValue
 
Python Google Cloud Function with CORS
Python Google Cloud Function with CORSPython Google Cloud Function with CORS
Python Google Cloud Function with CORS
RapidValue
 
Real-time Automation Result in Slack Channel
Real-time Automation Result in Slack ChannelReal-time Automation Result in Slack Channel
Real-time Automation Result in Slack Channel
RapidValue
 
Automation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDDAutomation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDD
RapidValue
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
RapidValue
 
Video Recording of Selenium Automation Flows
Video Recording of Selenium Automation FlowsVideo Recording of Selenium Automation Flows
Video Recording of Selenium Automation Flows
RapidValue
 
JMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeterJMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeter
RapidValue
 
Migration to Extent Report 4
Migration to Extent Report 4Migration to Extent Report 4
Migration to Extent Report 4
RapidValue
 
The Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QAThe Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QA
RapidValue
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API Requests
RapidValue
 
Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon Studio
RapidValue
 
How to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using ValgrindHow to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using Valgrind
RapidValue
 
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValueDevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
RapidValue
 

More from RapidValue (20)

Play with Jenkins Pipeline
Play with Jenkins PipelinePlay with Jenkins Pipeline
Play with Jenkins Pipeline
 
Accessibility Testing using Axe
Accessibility Testing using AxeAccessibility Testing using Axe
Accessibility Testing using Axe
 
Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in Kotlin
 
Automation in Digital Cloud Labs
Automation in Digital Cloud LabsAutomation in Digital Cloud Labs
Automation in Digital Cloud Labs
 
Microservices Architecture - Top Trends & Key Business Benefits
Microservices Architecture -  Top Trends & Key Business BenefitsMicroservices Architecture -  Top Trends & Key Business Benefits
Microservices Architecture - Top Trends & Key Business Benefits
 
Uploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADIUploading Data Using Oracle Web ADI
Uploading Data Using Oracle Web ADI
 
Appium Automation with Kotlin
Appium Automation with KotlinAppium Automation with Kotlin
Appium Automation with Kotlin
 
Build UI of the Future with React 360
Build UI of the Future with React 360Build UI of the Future with React 360
Build UI of the Future with React 360
 
Python Google Cloud Function with CORS
Python Google Cloud Function with CORSPython Google Cloud Function with CORS
Python Google Cloud Function with CORS
 
Real-time Automation Result in Slack Channel
Real-time Automation Result in Slack ChannelReal-time Automation Result in Slack Channel
Real-time Automation Result in Slack Channel
 
Automation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDDAutomation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDD
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
 
Video Recording of Selenium Automation Flows
Video Recording of Selenium Automation FlowsVideo Recording of Selenium Automation Flows
Video Recording of Selenium Automation Flows
 
JMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeterJMeter JMX Script Creation via BlazeMeter
JMeter JMX Script Creation via BlazeMeter
 
Migration to Extent Report 4
Migration to Extent Report 4Migration to Extent Report 4
Migration to Extent Report 4
 
The Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QAThe Definitive Guide to Implementing Shift Left Testing in QA
The Definitive Guide to Implementing Shift Left Testing in QA
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API Requests
 
Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon Studio
 
How to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using ValgrindHow to Perform Memory Leak Test Using Valgrind
How to Perform Memory Leak Test Using Valgrind
 
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValueDevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
 

Recently uploaded

OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 

Recently uploaded (20)

OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 

How to Build a Micro-Application using Single-Spa

  • 1. How to Build a Micro-Application using Single-Spa By, Shwetha Thomas, Senior Software Engineer
  • 2. How to Build a Micro-Application using Single-Spa © RapidValue Solutions 2 How to Create a Micro-Application using Single-Spa Following are the steps to create a micro-application: ● Create an angular application with a unique prefix. ng new --prefix app1 ● Enter the command ng add single-spa-angular in our project which in turn will do the following: - Install single-spa-angular - Generates a main.single-spa.ts in our project src/. - Generates single-spa-props.ts in src/single-spa/ - Generates asset-url.ts in src/single-spa/ - Generates an EmptyRouteComponent in src/app/empty-route/, to be used in app- routing.module.ts. - Add an npm script npm run build:single-spa. - Add an npm script npm run serve:single-spa. ● Install custom-webpack as dev dependency(npm install -D @angular-builders/custom- webpack@9.1.0) ● Add providers: [{provide: APP_BASE_HREF, useValue: '/'}] to app-routing.module.ts ● Add {path: '**', component: EmptyRouteComponent} to our app-routing.module.ts routes. ● Add a declaration for EmptyRouteComponent in app.module.ts ● Register the micro-app in the index.html file and call single-spa.start() function. For example,
  • 3. How to Build a Micro-Application using Single-Spa © RapidValue Solutions 3 Figure 1: Import single-spa Here, we are using import maps to set the path for our micro-app. student is the micro app here which we are registering. Since we are running locally, the localhosturl is given. Once we deploy the micro app, we can replace local url by giving the deployed url. main.js is a javascript file with the webpack which is created while running the app. While building the app, main-es2015.js file is created in the dist folder with the webpack. Figure 2: Register application This script tag is given inside the body. Here we are registering the micro-app and then calling the singleSpa.start(). In this example, the function returns true, which means the app will be loaded by default. We can also specify a route, so the micro-app will be mounted only on calling the specific route. If the function returns, location.pathname.startsWith(‘/student’); student micro-app will be loaded only on calling /student. There are some script tags, which is needed on loading micro-apps which are given below: <script src='https://unpkg.com/core-js-bundle@3.1.4/minified.js'></script>
  • 4. How to Build a Micro-Application using Single-Spa © RapidValue Solutions 4 <script src="https://unpkg.com/zone.js"></script> <script src="https://unpkg.com/import-map-overrides@1.6.0/dist/import-map-overrides.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/system.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/extras/amd.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/extras/named-exports.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.0.0/extras/named- register.min.js"></script> Make sure each micro-app runs in a different port locally. Serving a Micro-Application To serve a micro-application, run the following command: npm run serve:single-spa For angular version greater than 9, app name will be appended to this command. Check the package.json to know the exact command. For example, npm run serve:single-spa:app Building a Micro-Application .To build a micro-application, run the following command: npm run build:single-spa For angular version greater than 9, app name will be appended to this command. Check the package.json to know the exact command.
  • 5. How to Build a Micro-Application using Single-Spa © RapidValue Solutions 5 For example, npm run build:single-spa:app This will create a dist folder. How to Register the Micro-Apps into the Portal We can load any number of micro-apps in a single application which is the portal. To create a portal application, we need an HTML file where we can register our micro-apps and call singleSpa.start(). To register a micro-app into the portal, ● We must specify the main.js path of the micro-app in the portal ● Add the required scripts ● Register the micro-application ● Call singleSpa.start() Take a look at the images given below for a better understanding. Figure 1: Specify main.js path
  • 6. How to Build a Micro-Application using Single-Spa © RapidValue Solutions 6 Figure 2: Register micro-app and call start method This part is the same as registering a micro-app to itself. Following the above-mentioned steps ensures that the process of building and registering micro-applications in the portal is as seamless as possible.
  • 7. How to Build a Micro-Application using Single-Spa © RapidValue Solutions 7 About RapidValue RapidValue is a global leader in providing digital product engineering solutions including Mobility, Cloud, Omni-channel, IoT and RPA to enterprises worldwide. RapidValue offers its digital services to the world’s top brands, Fortune 1000 companies, and innovative emerging start-ups. With offices in the United States, the United Kingdom, Germany, and India and operations spread across the Middle-East, Europe, and Canada, RapidValue delivers enterprise service and solutions across various industry verticals. Disclaimer: This document contains information that is confidential and proprietary to RapidValue Solutions Inc. No part of it may be used, circulated, quoted, or reproduced for distribution outside RapidValue. If you are not the intended recipient of this report, you are hereby notified that the use, circulation, quoting, or reproducing of this report is strictly prohibited and may be unlawful. © RapidValue Solutions www.rapidvaluesolutions.com/blog www.rapidvaluesolutions.com +1 877.643.1850 contactus@rapidvaluesolutions.com