SlideShare a Scribd company logo
Node.js Firebase
Jul 23, 2023
Node.js
Hello!
Brion Silva
Associate Technical Lead
brion@wso2.com
What is 🤔
4
RUNTIME
5
Created by RYAN DAHL in 2009
Allows to execute Javascript outside the
browser
Enables developers to write a full stack
application in JavaScript
Uses an event-driven, non-blocking I/O event
loop for handling concurrent requests.
Comes with a built in package manager.
Built on top of Chrome V8 Engine
Open Source & Cross Platform Fast & Efficient
󰞐 Source : https://github.com/nodejs/node
⬇ Download: https://nodejs.org/en/download/current
What’s
What is npm?
● npm is Node.js's package manager.
● It manages dependencies in Node.js projects.
● Developers can install open-source packages with ease.
● npm simplifies adding functionality to Node.js apps.
● It ensures version control for package consistency.
7
What’s Event Loop?
What is Event Loop?
9
1st PRIORITY - Call Stack
➡ Handles Synchronous Code
2nd PRIORITY - MICROTASK QUEUE
➡ Handles Promises and Microtasks
3rd PRIORITY - TASK QUEUE
➡ Handles Callbacks (From DOM
APIs, I/O operations, Timers, etc.)
RESTful API Development with Node.js
What is a RESTful API?
11
API: Application Programming Interface
REST: Representational State Transfer
✅ STANDARDIZED
✅ STATELESS
✅ PERFORMANT
REQUEST vs RESPONSE
12
HTTP Methods
13
CREATE
READ
UPDATE
DELETE
POST
GET
PUT
DELETE
14
Demo
15
Scenario Overview
IDEALIZE
API
Base URL: http://localhost:3000
Endpoints:
http://localhost:3000/authors
http://localhost:3000/sessions
The API should be able to provide the organizing
committee to manage and organize the sessions
organized as prerequisites for IDEALIZE 2023.
Requirements:
⭐ Should be able to fetch, add, update & delete authors.
⭐ Should be able to fetch, add, update & delete sessions.
⭐ Add, update & delete should be protected.
Supporting Software
16
Package Manager - npm
Web Framework - Express.js
Database System - Firestore
REST Client - Postman
💡Can also use yarn or pnpm as well.
💡Can also use Nest, Sails, Koa, etc.
💡Can also use MySQL, MongoDB, etc.
💡Can also use Insomnia, curl, etc.
17
🚀 Minimal API: index.js ↗
Structuring the API
Controllers
Modules or functions that handle the business
logic for specific API endpoints.
Routes
HTTP methods that clients can use to interact
with the API.
Middleware
Functions that have access to the request and
response objects and can perform additional
processing before the final request handler
Folder Structure
18
󰞐 Code up to now: source ↗
Firebase
Hello!
Omal Wijegunawardana
Senior Software Engineer
omal@wso2.com
What’s
What is Firebase?
● Firebase in NOT a database.
● A collection of backend cloud computing services by Google.
● There is a free tier to try out things.
● It offers following services (and more)
⦿ Databases
⦿ Authentication
⦿ Storage
⦿ Hosting
⦿ Compute units
⦿ Analytics
22
What’s
What is Cloud Firestore?
● NoSQL cloud database
● Collection/Document structure of data
● Store data in flexible, hierarchical data structures
● Integrate with web or mobile technologies with provided SDKs
● Realtime updates
● Offline support
● Scales automatically
24
25
Demo
26
What’s next?
● Use an IDaaS like Asgardeo to Authorize users accessing your API.
⦿ https://wso2.com/asgardeo
● Consuming configurations from .env files.
⦿ Do not push the original file to the repository.
⦿ Push a .env.sample file with placeholders.
● Use a logger for logging in useful actions that’ll come in handy for debugging.
⦿ https://www.npmjs.com/package/winston
● You may have to use additional tools.
⦿ `cors`
⦾ Handle cross origin requests when embedding the API in to a web application.
⦿ `dotenv`
⦾ Read environment variables from .env files.
Question Time!
wso2.com
Thanks!

More Related Content

Similar to IDEALIZE 2023 - NodeJS & Firebase Session

Building a Distributed & Automated Open Source Program at Netflix
Building a Distributed & Automated Open Source Program at NetflixBuilding a Distributed & Automated Open Source Program at Netflix
Building a Distributed & Automated Open Source Program at Netflix
All Things Open
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
VMware Tanzu
 
What is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 DepokWhat is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 Depok
Imre Nagi
 
Wie macht man aus Software einen Online-Service in der Cloud
Wie macht man aus Software einen Online-Service in der CloudWie macht man aus Software einen Online-Service in der Cloud
Wie macht man aus Software einen Online-Service in der Cloud
Aarno Aukia
 
Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015
Microsoft
 
Top 13 Backend Frameworks for Web development in 2024
Top 13 Backend Frameworks for Web development in 2024Top 13 Backend Frameworks for Web development in 2024
Top 13 Backend Frameworks for Web development in 2024
Clarion Technologies
 
Gdsc muk - innocent
Gdsc   muk - innocentGdsc   muk - innocent
Gdsc muk - innocent
junaidhasan17
 
Top 11 Front-End Web Development Tools To Consider in 2020
 Top 11 Front-End Web Development Tools To Consider in 2020 Top 11 Front-End Web Development Tools To Consider in 2020
Top 11 Front-End Web Development Tools To Consider in 2020
Katy Slemon
 
InterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloud
InterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloudInterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloud
InterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloud
iMasters
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
Arjun Sreekumar
 
Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023
Netizens Technologies
 
Industrial Training.pptx
Industrial Training.pptxIndustrial Training.pptx
Industrial Training.pptx
SamraatBansal1
 
Understanding Node.js and Django.docx
Understanding Node.js and Django.docxUnderstanding Node.js and Django.docx
Understanding Node.js and Django.docx
Savior_Marketing
 
Red Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionRed Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus Introduction
John Archer
 
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegExploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
VMware Tanzu
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
Nodejs framework for app development.pdf
Nodejs framework for app development.pdfNodejs framework for app development.pdf
Nodejs framework for app development.pdf
Sufalam Technologies
 
NodeJS VS Python
NodeJS VS PythonNodeJS VS Python
NodeJS VS Python
Krishang Technolab
 
Joseph Ardolino CV (1)
Joseph Ardolino CV (1)Joseph Ardolino CV (1)
Joseph Ardolino CV (1)Joe Ardolino
 
Mastinder singh visualcv_resume
Mastinder singh visualcv_resumeMastinder singh visualcv_resume
Mastinder singh visualcv_resume
Mastinder Singh
 

Similar to IDEALIZE 2023 - NodeJS & Firebase Session (20)

Building a Distributed & Automated Open Source Program at Netflix
Building a Distributed & Automated Open Source Program at NetflixBuilding a Distributed & Automated Open Source Program at Netflix
Building a Distributed & Automated Open Source Program at Netflix
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
 
What is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 DepokWhat is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 Depok
 
Wie macht man aus Software einen Online-Service in der Cloud
Wie macht man aus Software einen Online-Service in der CloudWie macht man aus Software einen Online-Service in der Cloud
Wie macht man aus Software einen Online-Service in der Cloud
 
Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015
 
Top 13 Backend Frameworks for Web development in 2024
Top 13 Backend Frameworks for Web development in 2024Top 13 Backend Frameworks for Web development in 2024
Top 13 Backend Frameworks for Web development in 2024
 
Gdsc muk - innocent
Gdsc   muk - innocentGdsc   muk - innocent
Gdsc muk - innocent
 
Top 11 Front-End Web Development Tools To Consider in 2020
 Top 11 Front-End Web Development Tools To Consider in 2020 Top 11 Front-End Web Development Tools To Consider in 2020
Top 11 Front-End Web Development Tools To Consider in 2020
 
InterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloud
InterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloudInterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloud
InterCon 2016 - SLA vs Agilidade: uso de microserviços e monitoramento de cloud
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023
 
Industrial Training.pptx
Industrial Training.pptxIndustrial Training.pptx
Industrial Training.pptx
 
Understanding Node.js and Django.docx
Understanding Node.js and Django.docxUnderstanding Node.js and Django.docx
Understanding Node.js and Django.docx
 
Red Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionRed Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus Introduction
 
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegExploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Nodejs framework for app development.pdf
Nodejs framework for app development.pdfNodejs framework for app development.pdf
Nodejs framework for app development.pdf
 
NodeJS VS Python
NodeJS VS PythonNodeJS VS Python
NodeJS VS Python
 
Joseph Ardolino CV (1)
Joseph Ardolino CV (1)Joseph Ardolino CV (1)
Joseph Ardolino CV (1)
 
Mastinder singh visualcv_resume
Mastinder singh visualcv_resumeMastinder singh visualcv_resume
Mastinder singh visualcv_resume
 

Recently uploaded

Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
itech2017
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 

Recently uploaded (20)

Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 

IDEALIZE 2023 - NodeJS & Firebase Session

  • 5. RUNTIME 5 Created by RYAN DAHL in 2009 Allows to execute Javascript outside the browser Enables developers to write a full stack application in JavaScript Uses an event-driven, non-blocking I/O event loop for handling concurrent requests. Comes with a built in package manager. Built on top of Chrome V8 Engine Open Source & Cross Platform Fast & Efficient 󰞐 Source : https://github.com/nodejs/node ⬇ Download: https://nodejs.org/en/download/current
  • 7. What is npm? ● npm is Node.js's package manager. ● It manages dependencies in Node.js projects. ● Developers can install open-source packages with ease. ● npm simplifies adding functionality to Node.js apps. ● It ensures version control for package consistency. 7
  • 9. What is Event Loop? 9 1st PRIORITY - Call Stack ➡ Handles Synchronous Code 2nd PRIORITY - MICROTASK QUEUE ➡ Handles Promises and Microtasks 3rd PRIORITY - TASK QUEUE ➡ Handles Callbacks (From DOM APIs, I/O operations, Timers, etc.)
  • 10. RESTful API Development with Node.js
  • 11. What is a RESTful API? 11 API: Application Programming Interface REST: Representational State Transfer ✅ STANDARDIZED ✅ STATELESS ✅ PERFORMANT
  • 15. 15 Scenario Overview IDEALIZE API Base URL: http://localhost:3000 Endpoints: http://localhost:3000/authors http://localhost:3000/sessions The API should be able to provide the organizing committee to manage and organize the sessions organized as prerequisites for IDEALIZE 2023. Requirements: ⭐ Should be able to fetch, add, update & delete authors. ⭐ Should be able to fetch, add, update & delete sessions. ⭐ Add, update & delete should be protected.
  • 16. Supporting Software 16 Package Manager - npm Web Framework - Express.js Database System - Firestore REST Client - Postman 💡Can also use yarn or pnpm as well. 💡Can also use Nest, Sails, Koa, etc. 💡Can also use MySQL, MongoDB, etc. 💡Can also use Insomnia, curl, etc.
  • 17. 17 🚀 Minimal API: index.js ↗ Structuring the API Controllers Modules or functions that handle the business logic for specific API endpoints. Routes HTTP methods that clients can use to interact with the API. Middleware Functions that have access to the request and response objects and can perform additional processing before the final request handler Folder Structure
  • 18. 18 󰞐 Code up to now: source ↗
  • 22. What is Firebase? ● Firebase in NOT a database. ● A collection of backend cloud computing services by Google. ● There is a free tier to try out things. ● It offers following services (and more) ⦿ Databases ⦿ Authentication ⦿ Storage ⦿ Hosting ⦿ Compute units ⦿ Analytics 22
  • 24. What is Cloud Firestore? ● NoSQL cloud database ● Collection/Document structure of data ● Store data in flexible, hierarchical data structures ● Integrate with web or mobile technologies with provided SDKs ● Realtime updates ● Offline support ● Scales automatically 24
  • 26. 26 What’s next? ● Use an IDaaS like Asgardeo to Authorize users accessing your API. ⦿ https://wso2.com/asgardeo ● Consuming configurations from .env files. ⦿ Do not push the original file to the repository. ⦿ Push a .env.sample file with placeholders. ● Use a logger for logging in useful actions that’ll come in handy for debugging. ⦿ https://www.npmjs.com/package/winston ● You may have to use additional tools. ⦿ `cors` ⦾ Handle cross origin requests when embedding the API in to a web application. ⦿ `dotenv` ⦾ Read environment variables from .env files.