SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
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.

Weitere ähnliche Inhalte

Ähnlich wie Service Oriented Architecture in NodeJS

Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to AngularjsGaurav Agrawal
 
A Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework SurveyA Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework SurveyIRJET Journal
 
CV_PurnimaBalla_WCS-Consultant_7Yrs
CV_PurnimaBalla_WCS-Consultant_7YrsCV_PurnimaBalla_WCS-Consultant_7Yrs
CV_PurnimaBalla_WCS-Consultant_7YrsPurnima 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 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_BishnoiResume_Vivek_Bishnoi
Resume_Vivek_Bishnoivivek bishnoi
 
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and WorkingIRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and WorkingIRJET Journal
 
Components of a Generic Web Application Architecture
Components of  a Generic Web Application ArchitectureComponents of  a Generic Web Application Architecture
Components of a Generic Web Application ArchitectureMadonnaLamin1
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architecturesAws serverless multi-tier_architectures
Aws serverless multi-tier_architecturessonpro2312
 
Sharepoint as a service platform
Sharepoint as a service platformSharepoint as a service platform
Sharepoint as a service platformKashif Akram
 
Application server vs Web Server
Application server vs Web ServerApplication server vs Web Server
Application server vs Web ServerGagandeep Singh
 
Building Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
Building Microservices with Ruby on Rails: Maximizing Efficiency and ScalabilityBuilding Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
Building Microservices with Ruby on Rails: Maximizing Efficiency and ScalabilityBoTree Technologies
 
Final_Poster
Final_PosterFinal_Poster
Final_PosterAccenture
 
SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentalsabhi1112
 
Revolutionizing Web Development with React Server Components: A Comprehensive...
Revolutionizing Web Development with React Server Components: A Comprehensive...Revolutionizing Web Development with React Server Components: A Comprehensive...
Revolutionizing Web Development with React Server Components: A Comprehensive...Inexture Solutions
 
Backend Basic in nodejs express and mongodb PPT.pdf
Backend  Basic in nodejs express and mongodb PPT.pdfBackend  Basic in nodejs express and mongodb PPT.pdf
Backend Basic in nodejs express and mongodb PPT.pdfsadityaraj353
 
Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0Aravindharamanan S
 

Ähnlich wie Service Oriented Architecture in NodeJS (20)

Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Mean stack Magics
Mean stack MagicsMean stack Magics
Mean stack Magics
 
icv
icvicv
icv
 
A Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework SurveyA Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework Survey
 
CV_PurnimaBalla_WCS-Consultant_7Yrs
CV_PurnimaBalla_WCS-Consultant_7YrsCV_PurnimaBalla_WCS-Consultant_7Yrs
CV_PurnimaBalla_WCS-Consultant_7Yrs
 
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 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...
 
Resume_Vivek_Bishnoi
Resume_Vivek_BishnoiResume_Vivek_Bishnoi
Resume_Vivek_Bishnoi
 
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and WorkingIRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
 
Components of a Generic Web Application Architecture
Components of  a Generic Web Application ArchitectureComponents of  a Generic Web Application Architecture
Components of a Generic Web Application Architecture
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architecturesAws serverless multi-tier_architectures
Aws serverless multi-tier_architectures
 
Sharepoint as a service platform
Sharepoint as a service platformSharepoint as a service platform
Sharepoint as a service platform
 
Application server vs Web Server
Application server vs Web ServerApplication server vs Web Server
Application server vs Web Server
 
Resume
ResumeResume
Resume
 
Building Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
Building Microservices with Ruby on Rails: Maximizing Efficiency and ScalabilityBuilding Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
Building Microservices with Ruby on Rails: Maximizing Efficiency and Scalability
 
Final_Poster
Final_PosterFinal_Poster
Final_Poster
 
Final_Poster
Final_PosterFinal_Poster
Final_Poster
 
SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentals
 
Revolutionizing Web Development with React Server Components: A Comprehensive...
Revolutionizing Web Development with React Server Components: A Comprehensive...Revolutionizing Web Development with React Server Components: A Comprehensive...
Revolutionizing Web Development with React Server Components: A Comprehensive...
 
Backend Basic in nodejs express and mongodb PPT.pdf
Backend  Basic in nodejs express and mongodb PPT.pdfBackend  Basic in nodejs express and mongodb PPT.pdf
Backend Basic in nodejs express and mongodb PPT.pdf
 
Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0
 

Mehr von Andolasoft Inc

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Essential Functionalities Your Real Estate Web App Must Have.pdf
Essential Functionalities Your Real Estate Web App Must Have.pdfEssential Functionalities Your Real Estate Web App Must Have.pdf
Essential Functionalities Your Real Estate Web App Must Have.pdfAndolasoft Inc
 
A Complete Guide to Developing Healthcare App
A Complete Guide to Developing Healthcare AppA Complete Guide to Developing Healthcare App
A Complete Guide to Developing Healthcare AppAndolasoft Inc
 
Game-Changing Power of React Native for Businesses in 2024
Game-Changing Power of React Native for Businesses in 2024Game-Changing Power of React Native for Businesses in 2024
Game-Changing Power of React Native for Businesses in 2024Andolasoft Inc
 
A Complete Guide to Real Estate Website Development
A Complete Guide to Real Estate Website DevelopmentA Complete Guide to Real Estate Website Development
A Complete Guide to Real Estate Website DevelopmentAndolasoft Inc
 
How to Build Cross-Platform Mobile Apps Using Python
How to Build Cross-Platform Mobile Apps Using PythonHow to Build Cross-Platform Mobile Apps Using Python
How to Build Cross-Platform Mobile Apps Using PythonAndolasoft Inc
 
Impact of AI on Modern Mobile App Development
Impact of AI on Modern Mobile App DevelopmentImpact of AI on Modern Mobile App Development
Impact of AI on Modern Mobile App DevelopmentAndolasoft Inc
 
How to Optimize the SEO of Shopify Stores
 How to Optimize the SEO of Shopify Stores How to Optimize the SEO of Shopify Stores
How to Optimize the SEO of Shopify StoresAndolasoft Inc
 
14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App Performance14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App PerformanceAndolasoft Inc
 
The Ultimate Guide to Setting Up Your WooCommerce Store
The Ultimate Guide to Setting Up Your WooCommerce StoreThe Ultimate Guide to Setting Up Your WooCommerce Store
The Ultimate Guide to Setting Up Your WooCommerce StoreAndolasoft Inc
 
Ranking The Best PHP Development Companies in the World
Ranking The Best PHP Development Companies in the WorldRanking The Best PHP Development Companies in the World
Ranking The Best PHP Development Companies in the WorldAndolasoft Inc
 
Top 8 WordPress Design and Development Trends of 2023
Top 8 WordPress Design and Development Trends of 2023Top 8 WordPress Design and Development Trends of 2023
Top 8 WordPress Design and Development Trends of 2023Andolasoft Inc
 
List of 10 Best WordPress Development Companies
List of 10 Best WordPress Development CompaniesList of 10 Best WordPress Development Companies
List of 10 Best WordPress Development CompaniesAndolasoft Inc
 
WooCommerce vs Shopify: Which is Better For Your Online Store
WooCommerce vs Shopify: Which is Better For Your Online StoreWooCommerce vs Shopify: Which is Better For Your Online Store
WooCommerce vs Shopify: Which is Better For Your Online StoreAndolasoft Inc
 
Why Choose WooCommerce For Your eCommerce Store
Why Choose WooCommerce For Your eCommerce StoreWhy Choose WooCommerce For Your eCommerce Store
Why Choose WooCommerce For Your eCommerce StoreAndolasoft Inc
 
Django Workflow and Architecture
Django Workflow and ArchitectureDjango Workflow and Architecture
Django Workflow and ArchitectureAndolasoft Inc
 
Top Features And Updates Of Angular 13 You Must Know
Top Features And Updates Of Angular 13 You Must KnowTop Features And Updates Of Angular 13 You Must Know
Top Features And Updates Of Angular 13 You Must KnowAndolasoft Inc
 
How To Organize And Structure Your SASS Code
How To Organize And Structure Your SASS CodeHow To Organize And Structure Your SASS Code
How To Organize And Structure Your SASS CodeAndolasoft Inc
 
Why Businesses Need Open Source Software
Why Businesses Need Open Source Software Why Businesses Need Open Source Software
Why Businesses Need Open Source Software Andolasoft Inc
 
What is Closure and Its Uses in PHP
 What is Closure and Its Uses in PHP What is Closure and Its Uses in PHP
What is Closure and Its Uses in PHPAndolasoft Inc
 

Mehr von Andolasoft Inc (20)

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Essential Functionalities Your Real Estate Web App Must Have.pdf
Essential Functionalities Your Real Estate Web App Must Have.pdfEssential Functionalities Your Real Estate Web App Must Have.pdf
Essential Functionalities Your Real Estate Web App Must Have.pdf
 
A Complete Guide to Developing Healthcare App
A Complete Guide to Developing Healthcare AppA Complete Guide to Developing Healthcare App
A Complete Guide to Developing Healthcare App
 
Game-Changing Power of React Native for Businesses in 2024
Game-Changing Power of React Native for Businesses in 2024Game-Changing Power of React Native for Businesses in 2024
Game-Changing Power of React Native for Businesses in 2024
 
A Complete Guide to Real Estate Website Development
A Complete Guide to Real Estate Website DevelopmentA Complete Guide to Real Estate Website Development
A Complete Guide to Real Estate Website Development
 
How to Build Cross-Platform Mobile Apps Using Python
How to Build Cross-Platform Mobile Apps Using PythonHow to Build Cross-Platform Mobile Apps Using Python
How to Build Cross-Platform Mobile Apps Using Python
 
Impact of AI on Modern Mobile App Development
Impact of AI on Modern Mobile App DevelopmentImpact of AI on Modern Mobile App Development
Impact of AI on Modern Mobile App Development
 
How to Optimize the SEO of Shopify Stores
 How to Optimize the SEO of Shopify Stores How to Optimize the SEO of Shopify Stores
How to Optimize the SEO of Shopify Stores
 
14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App Performance14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App Performance
 
The Ultimate Guide to Setting Up Your WooCommerce Store
The Ultimate Guide to Setting Up Your WooCommerce StoreThe Ultimate Guide to Setting Up Your WooCommerce Store
The Ultimate Guide to Setting Up Your WooCommerce Store
 
Ranking The Best PHP Development Companies in the World
Ranking The Best PHP Development Companies in the WorldRanking The Best PHP Development Companies in the World
Ranking The Best PHP Development Companies in the World
 
Top 8 WordPress Design and Development Trends of 2023
Top 8 WordPress Design and Development Trends of 2023Top 8 WordPress Design and Development Trends of 2023
Top 8 WordPress Design and Development Trends of 2023
 
List of 10 Best WordPress Development Companies
List of 10 Best WordPress Development CompaniesList of 10 Best WordPress Development Companies
List of 10 Best WordPress Development Companies
 
WooCommerce vs Shopify: Which is Better For Your Online Store
WooCommerce vs Shopify: Which is Better For Your Online StoreWooCommerce vs Shopify: Which is Better For Your Online Store
WooCommerce vs Shopify: Which is Better For Your Online Store
 
Why Choose WooCommerce For Your eCommerce Store
Why Choose WooCommerce For Your eCommerce StoreWhy Choose WooCommerce For Your eCommerce Store
Why Choose WooCommerce For Your eCommerce Store
 
Django Workflow and Architecture
Django Workflow and ArchitectureDjango Workflow and Architecture
Django Workflow and Architecture
 
Top Features And Updates Of Angular 13 You Must Know
Top Features And Updates Of Angular 13 You Must KnowTop Features And Updates Of Angular 13 You Must Know
Top Features And Updates Of Angular 13 You Must Know
 
How To Organize And Structure Your SASS Code
How To Organize And Structure Your SASS CodeHow To Organize And Structure Your SASS Code
How To Organize And Structure Your SASS Code
 
Why Businesses Need Open Source Software
Why Businesses Need Open Source Software Why Businesses Need Open Source Software
Why Businesses Need Open Source Software
 
What is Closure and Its Uses in PHP
 What is Closure and Its Uses in PHP What is Closure and Its Uses in PHP
What is Closure and Its Uses in PHP
 

Kürzlich hochgeladen

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Kürzlich hochgeladen (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

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.