Building APIs with Node.js and Swagger

Jeremy Whitlock
Jeremy WhitlockSoftware Architect at Apigee
Building APIs in Node.js with Swagger
Jeremy Whitlock
What is an API?
An API is an “application programming
interface”… the interface for interaction.
API
APIs are Building Blocks
APIs in the Physical World
Input Contract
APIs Define an Interaction Model
Output Contract
APIs Define an Interaction Model
Without documentation…
… how can you expect
developers to get in?
What is Swagger?
http://swagger.io
Swagger is a specification to describe APIs.
Swagger emerges as an industry standard
Swagger Documents
• Written in JSON or YAML
• Clearly describe:
–Available APIs
–API input contract
–API output contract
–Required authn/authz
–Success/Error responses
–…
• Extensible
It is much more than just Swagger-UI!
How Do People Use Swagger?
Swagger
Mixing Swagger with Code
Swagger
Mixing Swagger with Code
Duplication
Code Without Swagger
Swagger-Driven APIs
Swagger: Not just for
documentation!
Swagger-Driven APIs
Swagger
Swagger Metadata
Routing
Security
Request Validation
Response Validation
Business Logic
There is no wrong approach.
Use what makes sense for you.
Swagger tooling for Node.js (and more)
> npm install swagger-tools
swagger-editor (http://editor.swagger.io/)
> npm install swagger
Building APIs with Node.js and Swagger
Announcing: apistudio.io
Write your spec and docs render live
Shareable spec and mock server
But it doesn't end there…
Thank you
1 of 30

Recommended

Rest API with Swagger and NodeJS by
Rest API with Swagger and NodeJSRest API with Swagger and NodeJS
Rest API with Swagger and NodeJSLuigi Saetta
866 views17 slides
Swagger for-your-api by
Swagger for-your-apiSwagger for-your-api
Swagger for-your-apiTony Tam
13.3K views23 slides
Swagger in the API Lifecycle by
Swagger in the API LifecycleSwagger in the API Lifecycle
Swagger in the API LifecycleOle Lensmar
2.1K views16 slides
Implement Web API with Swagger by
Implement Web API with SwaggerImplement Web API with Swagger
Implement Web API with SwaggerJiang Wu
2.6K views42 slides
Swagger APIs for Humans and Robots (Gluecon) by
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Tony Tam
7.8K views29 slides
Consuming Restful APIs using Swagger v2.0 by
Consuming Restful APIs using Swagger v2.0Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0Pece Nikolovski
17.6K views39 slides

More Related Content

What's hot

A Tour of Swagger for APIs by
A Tour of Swagger for APIsA Tour of Swagger for APIs
A Tour of Swagger for APIsAllen Dean
2.9K views34 slides
Documenting your REST API with Swagger - JOIN 2014 by
Documenting your REST API with Swagger - JOIN 2014Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014JWORKS powered by Ordina
830 views22 slides
Streamlining API with Swagger.io by
Streamlining API with Swagger.ioStreamlining API with Swagger.io
Streamlining API with Swagger.ioVictor Augusteo
466 views22 slides
Design Driven API Development by
Design Driven API DevelopmentDesign Driven API Development
Design Driven API DevelopmentSokichi Fujita
9.1K views20 slides
Developing Faster with Swagger by
Developing Faster with SwaggerDeveloping Faster with Swagger
Developing Faster with SwaggerTony Tam
1.1K views13 slides
Swagger 2.0 and Model-driven APIs by
Swagger 2.0 and Model-driven APIsSwagger 2.0 and Model-driven APIs
Swagger 2.0 and Model-driven APIsApigee | Google Cloud
2.5K views14 slides

What's hot(20)

A Tour of Swagger for APIs by Allen Dean
A Tour of Swagger for APIsA Tour of Swagger for APIs
A Tour of Swagger for APIs
Allen Dean2.9K views
Streamlining API with Swagger.io by Victor Augusteo
Streamlining API with Swagger.ioStreamlining API with Swagger.io
Streamlining API with Swagger.io
Victor Augusteo466 views
Design Driven API Development by Sokichi Fujita
Design Driven API DevelopmentDesign Driven API Development
Design Driven API Development
Sokichi Fujita9.1K views
Developing Faster with Swagger by Tony Tam
Developing Faster with SwaggerDeveloping Faster with Swagger
Developing Faster with Swagger
Tony Tam1.1K views
Introducing Swagger by Tony Tam
Introducing SwaggerIntroducing Swagger
Introducing Swagger
Tony Tam30.4K views
Introducing swagger by Amr Ali
Introducing swaggerIntroducing swagger
Introducing swagger
Amr Ali674 views
Level 3 REST Makes Your API Browsable by Matt Bishop
Level 3 REST Makes Your API BrowsableLevel 3 REST Makes Your API Browsable
Level 3 REST Makes Your API Browsable
Matt Bishop3.9K views
Designing APIs with OpenAPI Spec by Adam Paxton
Designing APIs with OpenAPI SpecDesigning APIs with OpenAPI Spec
Designing APIs with OpenAPI Spec
Adam Paxton6K views
API Developer Experience: Why it Matters, and How Documenting Your API with S... by SmartBear
API Developer Experience: Why it Matters, and How Documenting Your API with S...API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...
SmartBear1.9K views
Understanding how to use Swagger and its tools by Swagger API
Understanding how to use Swagger and its toolsUnderstanding how to use Swagger and its tools
Understanding how to use Swagger and its tools
Swagger API3.5K views
Swagger / Quick Start Guide by Andrii Gakhov
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start Guide
Andrii Gakhov7.6K views
Crystal clear service interfaces w/ Swagger/OpenAPI by Scott Triglia
Crystal clear service interfaces w/ Swagger/OpenAPICrystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPI
Scott Triglia549 views
API Design first with Swagger by Tony Tam
API Design first with SwaggerAPI Design first with Swagger
API Design first with Swagger
Tony Tam2.8K views
Writer APIs in Java faster with Swagger Inflector by Tony Tam
Writer APIs in Java faster with Swagger InflectorWriter APIs in Java faster with Swagger Inflector
Writer APIs in Java faster with Swagger Inflector
Tony Tam2.8K views
Swagger 2.0: Latest and Greatest by LaunchAny
Swagger 2.0: Latest and GreatestSwagger 2.0: Latest and Greatest
Swagger 2.0: Latest and Greatest
LaunchAny944 views
Document your rest api using swagger - Devoxx 2015 by johannes_fiala
Document your rest api using swagger - Devoxx 2015Document your rest api using swagger - Devoxx 2015
Document your rest api using swagger - Devoxx 2015
johannes_fiala2.1K views

Viewers also liked

Build APIs in Node.js and Swagger 2.0 with Apigee-127 by
Build APIs in Node.js and Swagger 2.0 with Apigee-127Build APIs in Node.js and Swagger 2.0 with Apigee-127
Build APIs in Node.js and Swagger 2.0 with Apigee-127Apigee | Google Cloud
9.3K views26 slides
API Docs Made Right / RAML - Swagger rant by
API Docs Made Right / RAML - Swagger rantAPI Docs Made Right / RAML - Swagger rant
API Docs Made Right / RAML - Swagger rantVladimir Shulyak
1.2K views48 slides
Swagger code motion talk by
Swagger code motion talkSwagger code motion talk
Swagger code motion talkVictor Trakhtenberg
1K views47 slides
I Love APIs 2015 API Lab Design-first API Development Using Node and Swagger by
I Love APIs 2015 API Lab Design-first API Development Using Node and SwaggerI Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
I Love APIs 2015 API Lab Design-first API Development Using Node and SwaggerApigee | Google Cloud
6.6K views35 slides
OpenAPI Specification概要 by
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要Kazuchika Sekiya
2.1K views9 slides
Swagger 入門 by
Swagger 入門Swagger 入門
Swagger 入門Yoshiaki Yoshida
7K views17 slides

Viewers also liked(9)

Build APIs in Node.js and Swagger 2.0 with Apigee-127 by Apigee | Google Cloud
Build APIs in Node.js and Swagger 2.0 with Apigee-127Build APIs in Node.js and Swagger 2.0 with Apigee-127
Build APIs in Node.js and Swagger 2.0 with Apigee-127
API Docs Made Right / RAML - Swagger rant by Vladimir Shulyak
API Docs Made Right / RAML - Swagger rantAPI Docs Made Right / RAML - Swagger rant
API Docs Made Right / RAML - Swagger rant
Vladimir Shulyak1.2K views
I Love APIs 2015 API Lab Design-first API Development Using Node and Swagger by Apigee | Google Cloud
I Love APIs 2015 API Lab Design-first API Development Using Node and SwaggerI Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
I Love APIs 2015 API Lab Design-first API Development Using Node and Swagger
Workshop Guide: RESTful Java Web Application with Spring Boot by Fabricio Epaminondas
Workshop Guide: RESTful Java Web Application with Spring BootWorkshop Guide: RESTful Java Web Application with Spring Boot
Workshop Guide: RESTful Java Web Application with Spring Boot
Workshop: Building a Streaming Data Platform on AWS by Amazon Web Services
Workshop: Building a Streaming Data Platform on AWSWorkshop: Building a Streaming Data Platform on AWS
Workshop: Building a Streaming Data Platform on AWS
Seeing is Believing: Free Versus Premium by LinkedIn
Seeing is Believing: Free Versus PremiumSeeing is Believing: Free Versus Premium
Seeing is Believing: Free Versus Premium
LinkedIn692.1K views

Similar to Building APIs with Node.js and Swagger

Swagger for startups by
Swagger for startupsSwagger for startups
Swagger for startupsTony Tam
1.4K views11 slides
I Love APIs 2015: Create Design-driven APIs with Node.js and Swagger by
I Love APIs 2015: Create Design-driven APIs with Node.js and SwaggerI Love APIs 2015: Create Design-driven APIs with Node.js and Swagger
I Love APIs 2015: Create Design-driven APIs with Node.js and SwaggerApigee | Google Cloud
1.6K views30 slides
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl... by
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...apidays
40 views82 slides
Open API Specifications - formerly swagger by
Open API Specifications - formerly swaggerOpen API Specifications - formerly swagger
Open API Specifications - formerly swaggerPradeep Kumar
1.3K views11 slides
John Feeney - The Importance of APIs and Headless technology In Digital Tran... by
John Feeney -  The Importance of APIs and Headless technology In Digital Tran...John Feeney -  The Importance of APIs and Headless technology In Digital Tran...
John Feeney - The Importance of APIs and Headless technology In Digital Tran...John Feeney
48 views24 slides
API-First Design and Django by
API-First Design and DjangoAPI-First Design and Django
API-First Design and DjangoKlaus Peter Laube
168 views34 slides

Similar to Building APIs with Node.js and Swagger(20)

Swagger for startups by Tony Tam
Swagger for startupsSwagger for startups
Swagger for startups
Tony Tam1.4K views
I Love APIs 2015: Create Design-driven APIs with Node.js and Swagger by Apigee | Google Cloud
I Love APIs 2015: Create Design-driven APIs with Node.js and SwaggerI Love APIs 2015: Create Design-driven APIs with Node.js and Swagger
I Love APIs 2015: Create Design-driven APIs with Node.js and Swagger
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl... by apidays
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
apidays40 views
Open API Specifications - formerly swagger by Pradeep Kumar
Open API Specifications - formerly swaggerOpen API Specifications - formerly swagger
Open API Specifications - formerly swagger
Pradeep Kumar1.3K views
John Feeney - The Importance of APIs and Headless technology In Digital Tran... by John Feeney
John Feeney -  The Importance of APIs and Headless technology In Digital Tran...John Feeney -  The Importance of APIs and Headless technology In Digital Tran...
John Feeney - The Importance of APIs and Headless technology In Digital Tran...
John Feeney48 views
Project onion with swagger by Abhinav Jha
Project onion with swaggerProject onion with swagger
Project onion with swagger
Abhinav Jha170 views
Learn Spring Boot With Bisky - Swagger by MarshallChabaga
Learn Spring Boot With Bisky - SwaggerLearn Spring Boot With Bisky - Swagger
Learn Spring Boot With Bisky - Swagger
MarshallChabaga12 views
Spec-first API Design for Speed and Safety by Atlassian
Spec-first API Design for Speed and SafetySpec-first API Design for Speed and Safety
Spec-first API Design for Speed and Safety
Atlassian14.4K views
API Athens Meetup - API standards 25-6-2014 by Michael Petychakis
API Athens Meetup - API standards   25-6-2014API Athens Meetup - API standards   25-6-2014
API Athens Meetup - API standards 25-6-2014
Michael Petychakis3.4K views
API Athens Meetup - API standards 25-6-2014 by openi_ict
API Athens Meetup - API standards 25-6-2014API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards 25-6-2014
openi_ict298 views
ProgrammableWeb's eSignature API Research Report by ProgrammableWeb
ProgrammableWeb's eSignature API Research ReportProgrammableWeb's eSignature API Research Report
ProgrammableWeb's eSignature API Research Report
ProgrammableWeb461.1K views
WSO2Con Asia 2014 - Building the API-Centric Enterprise by WSO2
WSO2Con Asia 2014 - Building the API-Centric EnterpriseWSO2Con Asia 2014 - Building the API-Centric Enterprise
WSO2Con Asia 2014 - Building the API-Centric Enterprise
WSO2618 views
42Crunch Security Audit for WSO2 API Manager 3.1 by WSO2
42Crunch Security Audit for WSO2 API Manager 3.142Crunch Security Audit for WSO2 API Manager 3.1
42Crunch Security Audit for WSO2 API Manager 3.1
WSO2205 views
Google Developer Groups, Why We Choose Angular.js by Almog Koren
Google Developer Groups, Why We Choose Angular.jsGoogle Developer Groups, Why We Choose Angular.js
Google Developer Groups, Why We Choose Angular.js
Almog Koren985 views
API Description Languages: Which Is The Right One For Me? by ProgrammableWeb
 API Description Languages: Which Is The Right One For Me?  API Description Languages: Which Is The Right One For Me?
API Description Languages: Which Is The Right One For Me?
ProgrammableWeb2.9K views

Recently uploaded

Business Analyst Series 2023 - Week 3 Session 5 by
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
165 views20 slides
Photowave Presentation Slides - 11.8.23.pptx by
Photowave Presentation Slides - 11.8.23.pptxPhotowave Presentation Slides - 11.8.23.pptx
Photowave Presentation Slides - 11.8.23.pptxCXL Forum
126 views16 slides
TE Connectivity: Card Edge Interconnects by
TE Connectivity: Card Edge InterconnectsTE Connectivity: Card Edge Interconnects
TE Connectivity: Card Edge InterconnectsCXL Forum
96 views12 slides
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ... by
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ..."Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...Fwdays
33 views39 slides
PharoJS - Zürich Smalltalk Group Meetup November 2023 by
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023Noury Bouraqadi
113 views17 slides
MemVerge: Past Present and Future of CXL by
MemVerge: Past Present and Future of CXLMemVerge: Past Present and Future of CXL
MemVerge: Past Present and Future of CXLCXL Forum
110 views26 slides

Recently uploaded(20)

Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10165 views
Photowave Presentation Slides - 11.8.23.pptx by CXL Forum
Photowave Presentation Slides - 11.8.23.pptxPhotowave Presentation Slides - 11.8.23.pptx
Photowave Presentation Slides - 11.8.23.pptx
CXL Forum126 views
TE Connectivity: Card Edge Interconnects by CXL Forum
TE Connectivity: Card Edge InterconnectsTE Connectivity: Card Edge Interconnects
TE Connectivity: Card Edge Interconnects
CXL Forum96 views
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ... by Fwdays
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ..."Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
Fwdays33 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi113 views
MemVerge: Past Present and Future of CXL by CXL Forum
MemVerge: Past Present and Future of CXLMemVerge: Past Present and Future of CXL
MemVerge: Past Present and Future of CXL
CXL Forum110 views
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum... by NUS-ISS
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
NUS-ISS28 views
Samsung: CMM-H Tiered Memory Solution with Built-in DRAM by CXL Forum
Samsung: CMM-H Tiered Memory Solution with Built-in DRAMSamsung: CMM-H Tiered Memory Solution with Built-in DRAM
Samsung: CMM-H Tiered Memory Solution with Built-in DRAM
CXL Forum105 views
[2023] Putting the R! in R&D.pdf by Eleanor McHugh
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh38 views
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi by Fwdays
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi
Fwdays26 views
Future of Learning - Khoong Chan Meng by NUS-ISS
Future of Learning - Khoong Chan MengFuture of Learning - Khoong Chan Meng
Future of Learning - Khoong Chan Meng
NUS-ISS31 views
The Importance of Cybersecurity for Digital Transformation by NUS-ISS
The Importance of Cybersecurity for Digital TransformationThe Importance of Cybersecurity for Digital Transformation
The Importance of Cybersecurity for Digital Transformation
NUS-ISS25 views
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure by CXL Forum
Astera Labs:  Intelligent Connectivity for Cloud and AI InfrastructureAstera Labs:  Intelligent Connectivity for Cloud and AI Infrastructure
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure
CXL Forum125 views
Combining Orchestration and Choreography for a Clean Architecture by ThomasHeinrichs1
Combining Orchestration and Choreography for a Clean ArchitectureCombining Orchestration and Choreography for a Clean Architecture
Combining Orchestration and Choreography for a Clean Architecture
ThomasHeinrichs168 views
Web Dev - 1 PPT.pdf by gdsczhcet
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdf
gdsczhcet52 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada110 views
Microchip: CXL Use Cases and Enabling Ecosystem by CXL Forum
Microchip: CXL Use Cases and Enabling EcosystemMicrochip: CXL Use Cases and Enabling Ecosystem
Microchip: CXL Use Cases and Enabling Ecosystem
CXL Forum129 views
Liqid: Composable CXL Preview by CXL Forum
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL Preview
CXL Forum121 views
JCon Live 2023 - Lice coding some integration problems by Bernd Ruecker
JCon Live 2023 - Lice coding some integration problemsJCon Live 2023 - Lice coding some integration problems
JCon Live 2023 - Lice coding some integration problems
Bernd Ruecker67 views
Future of Learning - Yap Aye Wee.pdf by NUS-ISS
Future of Learning - Yap Aye Wee.pdfFuture of Learning - Yap Aye Wee.pdf
Future of Learning - Yap Aye Wee.pdf
NUS-ISS38 views

Building APIs with Node.js and Swagger