API first approach for frontend developers

Post on 29-Nov-2014

392 views 2 download

description

Роман Бугаев @rbugaev «API first approach for frontend developers» Frontend Dev Conf'14 www.fdconf.by

transcript

API first approach for frontend developers

Roman Bugaev, API advocate @Adform BY

API - part of architecture

• Internal APIs are APIs, Too - The same rules

• Empower front-end

• Front-end developer designs API (UI for data)

Design/Pragmatic REST

• REST is an architectural style and not a strict standard

• #1 design principle: to maximize developer productivity

• Pragmatic REST is a design problem

• Keep simple things simple

API. Start from Spec/Mock

API. Start from Spec/Mock

API. Start from Spec/Mock

Collaborate

https://github.com/apiaryio/apiblueprint-sdk

Agility/HAL

• Amazon

"_links": {

"self": { "href": "/file/987" },

“root": { "href": "/folder/145", "title": “Root" }

}

https://github.com/mikekelly/backbone.halhttp://weluse.github.io/hyperagent/

Agility/compatible > beautiful

API Design @ GitHub (100 releases per day, in Adform only 25): http://tech.yandex.ru/events/yac/2013/talks/1100/

Performance/Conditional requests

• ETag - Most responses return an ETag header

• Last-Modified/ If-Modified-Since/ If-None-Matchheader

parse: function(response, xhr) {

if (xhr.status === 304)

return this.models

return response.data;

}

Thank you! Questions?

roman.bugaev@adform.com

bugaev_roman

http://linkedin.com/in/rbugaev