SlideShare a Scribd company logo
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development
Company
1
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development
Company
2
Service Oriented Architecture in NodeJS
What is Service oriented Architecture in NodeJS?
Serviceoriented architecture is a way to Building a backend applications by consisting
multiple independent services. A service can be any business logic that completes an action
and provides a specified result to the end point user.
Each service in SOA is a complete business function in itself.
For an Example
Let’s discuss about a grocery store.
The owner add the product details in the inventory. Then owner search to find data about a
unique product. And the backend application database query should be inside the service
section by leveraging data access layer. Then it securely fetch data and give the response to
the owner.
Layers in Service oriented Architecture
How SOA Works
● Here first when API call, in node app first it face router section where all the
authentication and validation occur through the middleware function. Then control
moves towards controller section which work is collect the incoming data related to
APIrequest. Here all the business logic to access data are combined inside a service.
So the controller invokes that service and service leverage data access layer to
connect with database and calculation. Then services return the data to the
controller. After that controller give the response to the end point user.
● The most important benefit in SOA is as all the services are independent and small
chunks so whenever we want to change our programing language it should be very
fast and easy in development process.
Router layer
Service layer
Data access layer
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development
Company
3
Flow chart diagram:
SOA Advantages
● Reliable– Even though service-oriented architecture has small and independent
services, it becomes easier to debug code as it checks small chunks instead of
checking a large codebase
● Independent of location– Services can be accessed through URL therefore change in
location doesn’t affect customer experience
● Scalable– Service-oriented architecture can run on multiple platforms and can
operate various servers within the given environment
● Reusability– The SOA uses its services in multiple applications independently without
disturbing other services
● Easy maintenance– SOA is an independent unit therefore updating becomes easy as
it is a single entity
● Agile– Due to reusable components and services, it helps developers to integrate
and build applications quickly according to requirements and consequently increases
the agility of service-oriented architecture.
Now question is why we shouldn’t did this directly inside the controller?
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development
Company
4
As router built with express so it combined with req and res object.So when we put our
business logic inside controller then at the testing we have to write mock for test with
response mock.
The problem is when we try to only test our business logic we can’t do that but when we
combined that inside service we can test that service without req, res object.
Code Example:
In this example we create a service that to resister a user in data base for sign up API.
In user.js controller receive all the request data and call the user service
// controllers/user.js
constUserService=require( "../services/UserService" );
constUserServicesec=newUserService();
asyncfunctionmakeUser ( req, res ) {
try {
letbodyData=req.body;
constmakeUser=awaitUserServicesec.create( bodyData );
returnres.send( makeUser );
} catch( err ) {
res.
status(500 ).
send( err );
}
}
module.exports={ makeUser };
Then in the user service folder import the data access layer and database model then
service used that data access layer and execute query in database
// services/UserService.js
// Data Access Layer
constMongooseService=require( "./MongooseService" );
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development
Company
5
constuserModel=require( "../models/user" );
classUserService {
constructor () {
this.MongooseService=newMongooseService(userModel );
}
asynccreate ( createUser ) {
try {
constresult=awaitthis.MongooseService.create( createUser );
return { success:true, body:result };
} catch( err ) {
return { success:false, error: err };
}
}
}
module.exports=UserService;
Conclusion:
The main aim of service-oriented architecture is to allow users to mix large chunks of
functionalities into one in order to build an application and services by combining services.
This architectural design of node backend application is considered as a best practice in
industrial label.

More Related Content

Similar to Service Oriented Architecture in NodeJS (20)

Rest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbook
Katy Slemon
 
Intoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
The Role of Angular Services in Web Development.pdf
The Role of Angular Services in Web Development.pdf
gauravpareekhawkscod
 
Mean stack Magics
Mean stack Magics
Aishura Aishu
 
icv
icv
Imran Raza
 
A Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework Survey
IRJET Journal
 
Sharing about Lucid Architecture x Laravel
Sharing about Lucid Architecture x Laravel
TrnLTunKit
 
CV_PurnimaBalla_WCS-Consultant_7Yrs
CV_PurnimaBalla_WCS-Consultant_7Yrs
Purnima Balla
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB
 
Resume_Vivek_Bishnoi
Resume_Vivek_Bishnoi
vivek bishnoi
 
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET Journal
 
Components of a Generic Web Application Architecture
Components of a Generic Web Application Architecture
MadonnaLamin1
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architectures
sonpro2312
 
Sharepoint as a service platform
Sharepoint as a service platform
Kashif Akram
 
Application server vs Web Server
Application server vs Web Server
Gagandeep Singh
 
Resume
Resume
Michael Alberts
 
Building Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
Building Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
BoTree Technologies
 
Final_Poster
Final_Poster
Accenture
 
Final_Poster
Final_Poster
varun_2289
 
Unit-III Service Oritented Architecture.pptx
Unit-III Service Oritented Architecture.pptx
jayakanthan8
 
Rest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbook
Katy Slemon
 
Intoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
The Role of Angular Services in Web Development.pdf
The Role of Angular Services in Web Development.pdf
gauravpareekhawkscod
 
A Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework Survey
IRJET Journal
 
Sharing about Lucid Architecture x Laravel
Sharing about Lucid Architecture x Laravel
TrnLTunKit
 
CV_PurnimaBalla_WCS-Consultant_7Yrs
CV_PurnimaBalla_WCS-Consultant_7Yrs
Purnima Balla
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB
 
Resume_Vivek_Bishnoi
Resume_Vivek_Bishnoi
vivek bishnoi
 
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET Journal
 
Components of a Generic Web Application Architecture
Components of a Generic Web Application Architecture
MadonnaLamin1
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architectures
sonpro2312
 
Sharepoint as a service platform
Sharepoint as a service platform
Kashif Akram
 
Application server vs Web Server
Application server vs Web Server
Gagandeep Singh
 
Building Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
Building Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
BoTree Technologies
 
Final_Poster
Final_Poster
Accenture
 
Unit-III Service Oritented Architecture.pptx
Unit-III Service Oritented Architecture.pptx
jayakanthan8
 

More from Andolasoft Inc (20)

Scalable Mobile App Development for Business Growth1 (1).pdf
Scalable Mobile App Development for Business Growth1 (1).pdf
Andolasoft Inc
 
Latest Facts and Trends in Fitness App Development
Latest Facts and Trends in Fitness App Development
Andolasoft Inc
 
Challenges of React Native App Development_ Effective Mitigation Strategies.pdf
Challenges of React Native App Development_ Effective Mitigation Strategies.pdf
Andolasoft Inc
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
 
Essential Functionalities Your Real Estate Web App Must Have.pdf
Essential Functionalities Your Real Estate Web App Must Have.pdf
Andolasoft Inc
 
A Complete Guide to Developing Healthcare App
A Complete Guide to Developing Healthcare App
Andolasoft Inc
 
Game-Changing Power of React Native for Businesses in 2024
Game-Changing Power of React Native for Businesses in 2024
Andolasoft Inc
 
A Complete Guide to Real Estate Website Development
A Complete Guide to Real Estate Website Development
Andolasoft Inc
 
How to Build Cross-Platform Mobile Apps Using Python
How to Build Cross-Platform Mobile Apps Using Python
Andolasoft Inc
 
Impact of AI on Modern Mobile App Development
Impact of AI on Modern Mobile App Development
Andolasoft Inc
 
How to Optimize the SEO of Shopify Stores
How to Optimize the SEO of Shopify Stores
Andolasoft Inc
 
14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App Performance
Andolasoft Inc
 
The Ultimate Guide to Setting Up Your WooCommerce Store
The Ultimate Guide to Setting Up Your WooCommerce Store
Andolasoft Inc
 
Ranking The Best PHP Development Companies in the World
Ranking The Best PHP Development Companies in the World
Andolasoft Inc
 
Top 8 WordPress Design and Development Trends of 2023
Top 8 WordPress Design and Development Trends of 2023
Andolasoft Inc
 
List of 10 Best WordPress Development Companies
List of 10 Best WordPress Development Companies
Andolasoft Inc
 
WooCommerce vs Shopify: Which is Better For Your Online Store
WooCommerce vs Shopify: Which is Better For Your Online Store
Andolasoft Inc
 
Why Choose WooCommerce For Your eCommerce Store
Why Choose WooCommerce For Your eCommerce Store
Andolasoft Inc
 
Django Workflow and Architecture
Django Workflow and Architecture
Andolasoft Inc
 
Top Features And Updates Of Angular 13 You Must Know
Top Features And Updates Of Angular 13 You Must Know
Andolasoft Inc
 
Scalable Mobile App Development for Business Growth1 (1).pdf
Scalable Mobile App Development for Business Growth1 (1).pdf
Andolasoft Inc
 
Latest Facts and Trends in Fitness App Development
Latest Facts and Trends in Fitness App Development
Andolasoft Inc
 
Challenges of React Native App Development_ Effective Mitigation Strategies.pdf
Challenges of React Native App Development_ Effective Mitigation Strategies.pdf
Andolasoft Inc
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
 
Essential Functionalities Your Real Estate Web App Must Have.pdf
Essential Functionalities Your Real Estate Web App Must Have.pdf
Andolasoft Inc
 
A Complete Guide to Developing Healthcare App
A Complete Guide to Developing Healthcare App
Andolasoft Inc
 
Game-Changing Power of React Native for Businesses in 2024
Game-Changing Power of React Native for Businesses in 2024
Andolasoft Inc
 
A Complete Guide to Real Estate Website Development
A Complete Guide to Real Estate Website Development
Andolasoft Inc
 
How to Build Cross-Platform Mobile Apps Using Python
How to Build Cross-Platform Mobile Apps Using Python
Andolasoft Inc
 
Impact of AI on Modern Mobile App Development
Impact of AI on Modern Mobile App Development
Andolasoft Inc
 
How to Optimize the SEO of Shopify Stores
How to Optimize the SEO of Shopify Stores
Andolasoft Inc
 
14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App Performance
Andolasoft Inc
 
The Ultimate Guide to Setting Up Your WooCommerce Store
The Ultimate Guide to Setting Up Your WooCommerce Store
Andolasoft Inc
 
Ranking The Best PHP Development Companies in the World
Ranking The Best PHP Development Companies in the World
Andolasoft Inc
 
Top 8 WordPress Design and Development Trends of 2023
Top 8 WordPress Design and Development Trends of 2023
Andolasoft Inc
 
List of 10 Best WordPress Development Companies
List of 10 Best WordPress Development Companies
Andolasoft Inc
 
WooCommerce vs Shopify: Which is Better For Your Online Store
WooCommerce vs Shopify: Which is Better For Your Online Store
Andolasoft Inc
 
Why Choose WooCommerce For Your eCommerce Store
Why Choose WooCommerce For Your eCommerce Store
Andolasoft Inc
 
Django Workflow and Architecture
Django Workflow and Architecture
Andolasoft Inc
 
Top Features And Updates Of Angular 13 You Must Know
Top Features And Updates Of Angular 13 You Must Know
Andolasoft Inc
 
Ad

Recently uploaded (20)

wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
AI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | Certivo
certivoai
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
AI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | Certivo
certivoai
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
Ad

Service Oriented Architecture in NodeJS

  • 1. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 1
  • 2. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 2 Service Oriented Architecture in NodeJS What is Service oriented Architecture in NodeJS? Serviceoriented architecture is a way to Building a backend applications by consisting multiple independent services. A service can be any business logic that completes an action and provides a specified result to the end point user. Each service in SOA is a complete business function in itself. For an Example Let’s discuss about a grocery store. The owner add the product details in the inventory. Then owner search to find data about a unique product. And the backend application database query should be inside the service section by leveraging data access layer. Then it securely fetch data and give the response to the owner. Layers in Service oriented Architecture How SOA Works ● Here first when API call, in node app first it face router section where all the authentication and validation occur through the middleware function. Then control moves towards controller section which work is collect the incoming data related to APIrequest. Here all the business logic to access data are combined inside a service. So the controller invokes that service and service leverage data access layer to connect with database and calculation. Then services return the data to the controller. After that controller give the response to the end point user. ● The most important benefit in SOA is as all the services are independent and small chunks so whenever we want to change our programing language it should be very fast and easy in development process. Router layer Service layer Data access layer
  • 3. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 3 Flow chart diagram: SOA Advantages ● Reliable– Even though service-oriented architecture has small and independent services, it becomes easier to debug code as it checks small chunks instead of checking a large codebase ● Independent of location– Services can be accessed through URL therefore change in location doesn’t affect customer experience ● Scalable– Service-oriented architecture can run on multiple platforms and can operate various servers within the given environment ● Reusability– The SOA uses its services in multiple applications independently without disturbing other services ● Easy maintenance– SOA is an independent unit therefore updating becomes easy as it is a single entity ● Agile– Due to reusable components and services, it helps developers to integrate and build applications quickly according to requirements and consequently increases the agility of service-oriented architecture. Now question is why we shouldn’t did this directly inside the controller?
  • 4. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 4 As router built with express so it combined with req and res object.So when we put our business logic inside controller then at the testing we have to write mock for test with response mock. The problem is when we try to only test our business logic we can’t do that but when we combined that inside service we can test that service without req, res object. Code Example: In this example we create a service that to resister a user in data base for sign up API. In user.js controller receive all the request data and call the user service // controllers/user.js constUserService=require( "../services/UserService" ); constUserServicesec=newUserService(); asyncfunctionmakeUser ( req, res ) { try { letbodyData=req.body; constmakeUser=awaitUserServicesec.create( bodyData ); returnres.send( makeUser ); } catch( err ) { res. status(500 ). send( err ); } } module.exports={ makeUser }; Then in the user service folder import the data access layer and database model then service used that data access layer and execute query in database // services/UserService.js // Data Access Layer constMongooseService=require( "./MongooseService" );
  • 5. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 5 constuserModel=require( "../models/user" ); classUserService { constructor () { this.MongooseService=newMongooseService(userModel ); } asynccreate ( createUser ) { try { constresult=awaitthis.MongooseService.create( createUser ); return { success:true, body:result }; } catch( err ) { return { success:false, error: err }; } } } module.exports=UserService; Conclusion: The main aim of service-oriented architecture is to allow users to mix large chunks of functionalities into one in order to build an application and services by combining services. This architectural design of node backend application is considered as a best practice in industrial label.