32
JSON all the way Javascript in the humanitarian world

JSON all the way

Embed Size (px)

Citation preview

Page 1: JSON all the way

JSON all the wayJavascript in the humanitarian world

Page 2: JSON all the way

Who the hell..?我们是谁

Ronan Berder小熊

Makara Wang王浩宇

Wiredcrafthttp://wiredcraft.com

Page 3: JSON all the way

And what do you do?我们做什么

• Data centric apps

• Humanitarian and non-profit space

• In Shanghai and Washington, DC(and soon SF)

Page 4: JSON all the way

Before we get started引言

Page 5: JSON all the way

What’s Reliefweb?Reliefweb是什么

• Re-launched in 2011

• News for the humanitarian world

• Built on Drupal... I know(PHP + MySQL + Sphinx)

Page 6: JSON all the way

http://reliefweb.int

Page 7: JSON all the way

What then?客户需求

• Need to innovate

• Built a prototype and pitched it:

User profiles + Mobile

Page 8: JSON all the way

The breakup失败

Page 9: JSON all the way

What happened?为什么

• Fighting the framework

• Performance concerns

• Way too many layers

Page 10: JSON all the way
Page 11: JSON all the way

Back to the whiteboard更高要求

• We need consistency

• We need simplicity

• We need flexibility

• We need speed

And about a million other things...

Page 12: JSON all the way

So, what do we build?目标

Page 14: JSON all the way

Who will save us?救星来了

Page 15: JSON all the way

Why JS?

• Great for a RESTful API

• Great too for a light client

• Other perks; performance, tools...

And... we already know it.

Page 16: JSON all the way

The back-end服务端

Page 17: JSON all the way

Bones for the API什么是 � Bones

• RESTful JSON + OAuth

• Bones = express.js + backbone.jshttps://github.com/developmentseed/bones

• Share models on client and server

Page 18: JSON all the way

Show me the code

</>

Page 19: JSON all the way

And then some more...更多规范

• JSON Schema

• OAuth

• REST

Page 20: JSON all the way

The front-end客户端

Page 21: JSON all the way

Using what we know最流行的

• HTML5 + jQuery mobile + Backbone.js

• Phonegap

• and... Jekyll

Page 22: JSON all the way

Why Jekyll?

• HTML5 apps can get messy

• Jekyll gives us templates & includesAnd we’ll be able to host it on Github pages...

Page 23: JSON all the way

Show me the code

</>

Page 24: JSON all the way

A tiny bit about storage存储方案

Page 25: JSON all the way

Elastic search

• Started with CouchDB

• Now Elastic Search & Redis, because:

• Full text search,

• Document oriented,

• REST API,

Slower, but we don’t care.

Page 26: JSON all the way

Show me the code

</>

Page 27: JSON all the way

A few thoughts少少结论

Page 28: JSON all the way

Why so serious?不好的

• Not a lot of best practicesbut we’re trying hard to build some

• Some stuff still sucksjQuery mobile, I’m looking at you

Page 29: JSON all the way

The good stuff好的

• JSON all the way

• Javascript all the way

And performance, tools, community...

Page 30: JSON all the way
Page 31: JSON all the way

What we see我们看到的未来

• The line is getting blurry:

• more fragmentation...

• but more communication

• Loosely coupled systems

Page 32: JSON all the way

Questions?有问题吗?