Design-first API Development using Swagger and Node

  • View
    1.010

  • Download
    3

  • Category

    Software

Preview:

Citation preview

1

Design-First API Development Using Swagger & Node

Scott Ganyo, Apigee Prabhat Jha, Apigee @theganyo @prabhatjha

Agenda

2

1. APIs - What and Why

2. What is Design-First API development?

3. Some Apigee internal use cases4. Customer Reference5. Tools & demo6. Q&A

©2015 Apigee. All Rights Reserved.

APIS

3

An API…

Defines an HTTP service

Serves its client apps

Drives service adoption

APIs

4©2015 Apigee. All Rights Reserved.

APIs are for…

Developers

Apps :

• External

• Internal

Microservices

Devices

5©2015 Apigee. All Rights Reserved.

What APIs are not ?

SOA++

ESB

6©2015 Apigee. All Rights Reserved.

Design-First API Development

7

The Zen of API Development

The code defines the API

The API generates the code

The code is the API

API-driven code

8©2015 Apigee. All Rights Reserved.

The code defines the API

9©2015 Apigee. All Rights Reserved.

Annotation-driven

Maintained in code

API is generated

The API generates the codeInterface Definition Language (IDL) defines the API

Client and server side code stubs are generated

Examples: SOAP, CORBA, and similar RPC systems

10©2015 Apigee. All Rights Reserved.

The code is the API

11©2015 Apigee. All Rights Reserved.

Interpreted

No formal specification

API-driven philosophy

12©2015 Apigee. All Rights Reserved.

The API must be designed first.

API-driven philosophy

13©2015 Apigee. All Rights Reserved.

API design, documentation, and code must remain in sync.

API-driven philosophy

14©2015 Apigee. All Rights Reserved.

The system must adhere to the "DRY Principle."

API-driven philosophy

15©2015 Apigee. All Rights Reserved.

The API must directly drive runtime and documentation.

Swagger-Node

16

Swagger-Node: Flow Diagram

17©2015 Apigee. All Rights Reserved.

Swagger-Node

18©2015 Apigee. All Rights Reserved.

The API is written in Swagger, optionally using API Studio (apistudio.io)

The Swagger API document is parsed when server starts

Incoming calls are classified, validated, and routed in real time

Integrates with Connect, Express, Hapi, Restify, Sails...

Incorporates a plugin model for Swagger (or non-Swagger) extensions

Apigee Use Cases

19

Use case: Recommendation API (Apigee Insights)

• To personalize an app experience, developers need to quickly create APIs that mashup results from big fata machine learning and real-time events. Swagger-node enables quick creation of those APIs via Swagger, and create the business-logic necessary in node.js.

20©2015 Apigee. All Rights Reserved.

Use case: API Studio

• Authoring• Collaboration• Response simulation

21©2015 Apigee. All Rights Reserved.

Use case: Test Coverage

• Historical test coverage analysis• APIs for CI to update• UI for test teams

22©2015 Apigee. All Rights Reserved.

Customer Reference

23

Burberry

24©2015 Apigee. All Rights Reserved.

Tools & Demo

25

API Lifecycle management tools• Write & Collaborate:

– API Studio (http://apistudio.io)• Develop :

– Swagger-Node (npm install -g swagger)• Deploy

• Apigee Edge• Your PaaS

• Publish• Apigee Dev Portal• API Studio

26©2015 Apigee. All Rights Reserved.

Demo

27©2015 Apigee. All Rights Reserved.

Where to get help?

https://community.apigee.com

28©2015 Apigee. All Rights Reserved.

Q&A

29

Thank You

30

Recommended