api code generation

24
http://www.flickr.com/photos/iprozac/3609806359/ BarcelonaJS API Code Generation 13 February 2014 Bruno Pedro

Upload: bruno-pedro

Post on 14-Jan-2015

3.284 views

Category:

Technology


6 download

DESCRIPTION

How to generate nodejs API consumer code from a Postman collections, with the help of the API Blueprint.

TRANSCRIPT

Page 1: API Code Generation

http://www.flickr.com/photos/iprozac/3609806359/

BarcelonaJS API Code Generation13 February 2014

Bruno Pedro

Page 2: API Code Generation

Bruno Pedro Web and Cloud Computing Technologist with over ten years’ experience. CTO of GetApp. Editor at APIUX.com.

http://brunopedro.com/

Page 3: API Code Generation

Summary

• Postman

• API Blueprint

• Code generation

• Questions

Page 4: API Code Generation

Postman• Powerful HTTP client

• Chrome application

• Advanced request builder

• History, Collections, Authentication, Documentation, …http://www.getpostman.com/

Page 5: API Code Generation

Postman

Page 6: API Code Generation

Postman

Page 7: API Code Generation

Postman

Page 8: API Code Generation

Postman

Page 9: API Code Generation

Postman

Page 10: API Code Generation

Postman

Page 11: API Code Generation

Postman

Page 12: API Code Generation

API Blueprint• Web API Language

• Markdown syntax

• Documentation + method description

• Powerful toolinghttp://apiblueprint.org/ !

Page 13: API Code Generation

API Blueprint• Testing with Dredd

• HTML docs with aglio

• Mock server with Contractor

Page 14: API Code Generation

API Blueprint

Page 15: API Code Generation

API Blueprint

Page 16: API Code Generation

Code Generation

Page 17: API Code Generation

Code Generation• collection

• markdown

• functions

Page 18: API Code Generation

Code Generation• collection

• markdown

• functionsnodeunit

Page 19: API Code Generation

postman2apiblueprint• Reads Postman collection JSON

• API endpoints

• HTTP methods (GET, POST, etc)

• Headers

• Parameters

• Converts to API Blueprint

Page 20: API Code Generation

postman2apiblueprint

Page 21: API Code Generation

apiblueprint2nodejs• Reads API Blueprint markdown

• Uses protagonist

• Converts markdown into JSON

• Generates nodejs code from JSON !

Page 22: API Code Generation

apiblueprint2nodejs

Page 23: API Code Generation

Future work

• Explore Postman Collection runner

• Richer output to API Blueprint

• Better code generation

• Reverse operation?

Page 24: API Code Generation

Questions?

Thank you!