REST API Development with Node.js -  Fernando Doglio

REST API Development with Node.js (eBook)

Manage and Understand the Full Capabilities of Successful REST Development
eBook Download: PDF
2018 | 2. Auflage
XVII, 331 Seiten
Apress (Verlag)
978-1-4842-3715-1 (ISBN)
Systemvoraussetzungen
66,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Manage and understand the full capabilities of successful REST development. REST API development is a hot topic in the programming world, but not many resources exist for developers to really understand how you can leverage the advantages.

This completely updated second edition provides a brief background on REST and the tools it provides (well known and not so well known), then explains how there is more to REST than just JSON and URLs. You will learn about the maintained modules currently available in the npm community, including Express, Restify, Vatican, and Swagger. Finally you will code an example API from start to finish, using a subset of the tools covered.

The Node community is currently flooded with modules; some of them are published once and never updated again - cluttering the entire universe of packages. Pro REST API Development with Node.js shines light into that black hole of modules for the developers trying to create an API. Understand REST API development with Node.js using this book today.   

What You'll Learn

  • Understand how REST and API development mix up with Node.js
  • Create a scalable, technology agnostic, and uniform interface
  • Prepare your services to be consumed by your clients
  • Test and deploy your API
  • Review troubleshooting techniques 

Who This Book Is For

Any Node.js developer who wants to fully understand REST API development. 

Beginner and Intermediate Node.js developers who are looking to fully understand how to create RESTful microservices. 



Fernando Doglio has been working as a Web Developer for the past 10 years. In that time, he's come to love the web, and has had the opportunity of working with most of the leading technologies at the time, suchs as PHP, Ruby on Rails, MySQL, and Node. js, Angular.js, AJAX, REST APIs and others. In his spare time, he likes to tinker and learn new things, which is why his Github account keeps getting new repos every month. He's also a big Open Source supporter, trying to convert new people into it. He can be contacted on twitter at: @deleteman123. When not programming, he can be seen spending time with his family.
Manage and understand the full capabilities of successful REST development. REST API development is a hot topic in the programming world, but not many resources exist for developers to really understand how you can leverage the advantages.This completely updated second edition provides a brief background on REST and the tools it provides (well known and not so well known), then explains how there is more to REST than just JSON and URLs. You will learn about the maintained modules currently available in the npm community, including Express, Restify, Vatican, and Swagger. Finally you will code an example API from start to finish, using a subset of the tools covered.The Node community is currently flooded with modules; some of them are published once and never updated again - cluttering the entire universe of packages. Pro REST API Development with Node.js shines light into that black hole of modules for the developers trying to create an API. Understand REST API development with Node.js using this book today.   What You'll LearnUnderstand how REST and API development mix up with Node.jsCreate a scalable, technology agnostic, and uniform interfacePrepare your services to be consumed by your clientsTest and deploy your APIReview troubleshooting techniques Who This Book Is ForAny Node.js developer who wants to fully understand REST API development. Beginner and Intermediate Node.js developers who are looking to fully understand how to create RESTful microservices. 

Fernando Doglio has been working as a Web Developer for the past 10 years. In that time, he's come to love the web, and has had the opportunity of working with most of the leading technologies at the time, suchs as PHP, Ruby on Rails, MySQL, and Node. js, Angular.js, AJAX, REST APIs and others. In his spare time, he likes to tinker and learn new things, which is why his Github account keeps getting new repos every month. He's also a big Open Source supporter, trying to convert new people into it. He can be contacted on twitter at: @deleteman123. When not programming, he can be seen spending time with his family.

Table of Contents 5
About the Author 10
About the Technical Reviewer 11
Acknowledgments 12
Introduction 13
Chapter 1: REST 101 14
Where Did It All Start? 15
REST Constraints 17
Client–Server 17
Stateless 18
Cacheable 19
Uniform Interface 20
Layered System 22
Code-on-Demand 23
Resources, Resources, Resources 24
Representations 24
Content Negotiation 26
Using File Extensions 26
Resource Identifier 27
Actions 28
Complex Actions 29
Use Collection of Actions 30
Single-Entity Searches 32
Multi-Entity Searches 32
Hypermedia in the Response and Main Entry Point 33
A Few Notes on HAL 36
Status Codes 39
REST vs. the Past 41
Summary 50
Chapter 2: API Design Best Practices 51
What Defines a Good API? 51
Developer-Friendly 52
Communication’s Protocol 52
Easy-to-Remember Access Points 53
Uniform Interface 54
Transport Language 56
Why JSON? 56
Extensibility 58
How Is Extensibility Managed? 58
Up-to-Date Documentation 62
Proper Error Handling 65
Phase 1: Development of the Client 65
Phase 2: The Client Is Implemented and Being Used by End Users 67
Multiple SDK / Libraries 68
Security 69
Accessing the System 70
Almost Stateless Methods 70
Basic Auth with TSL 70
Digest Auth 72
OAuth 1.0a 74
OAuth 2.0 76
A Stateless Alternative 76
Scalability 78
Summary 82
Chapter 3: Node.js and REST 83
Asynchronous Programming 84
Async Advanced 88
Parallel Flow 88
Serial Flow 91
Asynchronous I/O 93
Async I/O vs. Sync I/O 97
Simplicity 99
Dynamic Typing 100
Object-Oriented Programming Simplified 101
The new Class construct from ES6 103
Functional Programming Support 105
Duck Typing 106
Native Support for JSON 107
npm: The Node Package Manager 108
Who’s Using Node.js? 110
Summary 111
Chapter 4: Architecting a REST API 112
The Request Handler, the Pre-Process Chain, and the Routes Handler 113
MVC: a.k.a. Model–View–Controller 118
Alternatives to MVC 123
Hierarchical MVC 123
Model–View–ViewModel 126
Model–View–Adapter 127
Response Handler 127
Summary 130
Chapter 5: Working with Modules 131
Our Alternatives 132
Request/Response Handling 132
Routes Handling 132
Middleware 133
Up-to-Date Documentation 135
Hypermedia on the Response 135
Response and Request Validation 135
The List of Modules 135
HAPI 136
Express.js 141
Restify 148
Naming Routes 149
Versioning Routes 151
Content Negotiation 152
Vatican.js 153
swagger-node-express 158
I/ODocs 164
Halson 170
HAL 173
JSON-Gate 177
TV4 179
Summary 182
Chapter 6: Planning Your REST API 183
The Problem 183
The Specifications 187
Keeping Track of Stock per Store 193
UML Diagram 193
Choosing a Database Storage System 195
Fast Integration 196
Easy-to-Change Schemas 196
Ability to Handle Entity Relations 196
Seamless Integration Between Our Models and the Database Entities 197
And the Winner Is… 197
Choosing the Right Modules for the Job 198
Summary 199
Chapter 7: Developing Your REST API 200
Minor Changes to the Plan 201
Simplification of the Store–Employee Relationship 201
Adding Swagger UI 201
Simplified Security 202
A Small Backdoor for Swagger 202
MVC 203
Folder Structure 203
The Source Code 205
config 206
Controllers 206
lib 237
Models 246
request_schemas 252
schemas 254
swagger-ui 263
Root Folder 264
Middleware Setup 267
Setup Section 268
Summary 268
Chapter 8: Testing your API 269
Testing 101 269
The Definition 269
The Tools 272
Test Cases & Test Suites
Assertions 272
Stubs, Mocks, Spies, and Dummies 273
Stubs 275
Mocks 276
Spies 277
Dummies 278
Fixtures 278
Best Practices 279
Testing with Node.js 280
Testing Without Modules 280
ok(value[, message]) 281
deepStrictEqual(actual, expected[, message]) 281
throws(block[, error][, message) 282
Mocha 283
Installing and First Steps 284
Testing Asynchronous Code 285
Testing Our API 286
Summary 290
Chapter 9: Deploying into Production 291
Different Environments 291
The Classical Development Workflow 291
Tips for Your Production Environment 294
High Availability 294
Load Balancers 294
Zone Availablity 297
Doing the Actual Deployment 299
Shipit 300
Installation 303
What about Continuous Integration? 303
PM2 304
Why Do You Need a Process Manager? 305
So, What Now? 305
Summary 310
Chapter 10: Troubleshooting 311
Asynchronous Programming 311
The Controllers Action’s Code 312
The Middleware Functions 314
Issues Configuring the Swagger UI 316
CORS: a.k.a. Cross-Origin Resource Sharing 318
Summary 322
Index 323

Erscheint lt. Verlag 19.7.2018
Zusatzinfo XVII, 323 p. 61 illus.
Verlagsort Berkeley
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Software Entwicklung
Mathematik / Informatik Informatik Web / Internet
Schlagworte API design • API development • Doglio • JavaScript • REST development
ISBN-10 1-4842-3715-3 / 1484237153
ISBN-13 978-1-4842-3715-1 / 9781484237151
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 6,6 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Das umfassende Handbuch

von Jürgen Sieben

eBook Download (2023)
Rheinwerk Computing (Verlag)
89,90
Eine kompakte Einführung

von Brendan Burns; Joe Beda; Kelsey Hightower; Lachlan Evenson

eBook Download (2023)
dpunkt (Verlag)
39,90