Let’s face it: the term REST is treated as a buzzword these days rather than as an accurate description of the Web’s blueprints. Everybody claim to do REST APIs; the truth is - nobody is doing REST API. It’s time to stop this. In my presentation I’d like to go with you through the original specifications and build an API that will respect all the constraints. All live, no prepared things. Then, we will compare the results with other API that claim to be REST. You will be surprised how different the results will be!
4. Express Gateway
Monolith vs. Microservices
09/11/17 4
Business requirements change rapidly AND continuously – so the need for
shipping updated version of your app are increasing exponentially.
A microservice app
Continuous updating in parts.
A monolithic app
All or nothing — a big, giant thing that can’t
fit through the shipping door.
vs.
5. Express Gateway
Microservices:
an ideal that’s been out there for a long time
Decades of best practices in the modern web era
Web-scale experiences (Amazon, Google, Netflix, etc)
Cloud native technologies
— Microservices as individual processes
— Processes encapsulated in containers
— Containers orchestrated
09/11/17 5
6. Express Gateway
Microservices and APIs
The natural evolution of microservices are APIs to the “N” client - client
traditionally was built by the company, but now can be built by anyone
APIs = business leverage and amplification
09/11/17 6
8. Express Gateway
An Architectural Style, Not a Fixed Blueprint
Microservices are the new norm – but also more of an architectural
style
There are too many ways to slice and dice
Examples
Problem 1: Services can be discreetly defined in many ways
– Business capability
– Domain and subdomains
– Model
Problem 2: Deployment units can vary in granularity
– How many services per host?
– What services per host?
09/11/17 8
9. Microservices: a new set of problems to deal with
9
2. Propagation of server implementation details to the client
1. Duplication of code among services
3. A lot more we’re not going to look into now
Express Gateway09/11/17
10. Express Gateway
API Gateway Pattern
Problem 1: Disparate Microservices
Solution: Centralized Middleware Public APIs
• Authentication
• Security
• Traffic Control
• Ops
• Logging
• Transformations
• Etc
API Gateway
09/11/17 10
Client Only for internal usage
Only for specific
partners
AWS Lambda, etc
11. Express Gateway
API Gateway Pattern (cont’d)
Problem 2: Different Granularity Required
Solution: Orchestration
• Optimized endpoints
• Request collapsing
• And more
API Gateway
Invoices DB schema
Customers DB schema
Orders DB schema
09/11/17 11
Client
12. REST
12Express Gateway09/11/17
Roy Fielding — dissertation published on 2000
A system that has the following features:
– Stateless
– Layered
– Code on Demand
– Client/Server
– Uniform interface
Rationale on deployment of HTTP/1.1
14. Uniform interface
14
Resource identification in requests
– URI
Resource manipulation through representations
– HTTP Content Negotiation mechanism
Self descriptive messages
– Headers + payload contain all the data you need
Hypermedia as the Engine of Application State
– HTML is an Hypermedia format
Express Gateway09/11/17
17. Can we make it with JSON?
17
Multiple JSON and Hypermedia friendly formats
HAL + JSON
– Resources
– Links
Siren
– Entities
– Links
– Actions
RESTful JSON
– Links
– Resources
Express Gateway09/11/17
18. RESTful JSON specs
1. JSON objects MAY include a url property to indicate a link to itself
18
2. JSON objects MAY append _url to properties to indicate related links
Express Gateway09/11/17
{
"_id": "59fdb32de1e514001212698a",
"name": "Vincenzo",
"surname": "Chianese",
"!__v": 0,
"invoices_url": "http:!//invoices.apitest.lan:81/59fdb32de1e514001212698a/invoices",
"url": "http:!//customers.apitest.lan:81/59fdb32de1e514001212698a"
},
Where I am
Where can I go from here
20. Express Gateway
Express Gateway
Why?
No matter what style - Microservices and APIs need Super Glue
Everyone knows Express
Already Proven - countless people have rolled their own
What?
A dynamic Express outfitted with Middleware for the API Gateway use case
When?
July 2017
09/11/17 20
21. Express Gateway
Features and Benefits
Centralized Declarative Configuration - Manage, Control and Visualize
API Consumer Management (users, apps, credentials, tokens etc.) – Get What You Need Most
Express Middleware Driven Plugins – Getting Started is Dead Simple
Security – Peace of Mind
Basic Authorization
Key Authorization
Oauth 2.0
CORS
Quality of Services –Your Way
Dynamic Routing
Simple Logger
Proxy with Load Balancer (coming soon)
Rate Limiter
JavaScript Expression
09/11/17 21
25. Express Gateway
Get Involved!
How is this different?
A seamless and unified platform for developing, managing and orchestrating
microservices and APIs insanely fast – managing is just the tip of the iceberg!
Installing is Dead Simple
09/11/17 25
https://express-gateway.io
$ npm install express-gateway
26. Express Gateway
Quick Plug - LunchBadger
Build, Manage, Deploy your Microservices as APIs
through One Unified Experience:
Express Gateway - Management
Express (LoopBack) - Composition
Docker and Kubernetes - Cloud Native Portable Runtime
09/11/17 26