JSON all the way
-
Upload
ronan-berder -
Category
Technology
-
view
778 -
download
1
Transcript of JSON all the way
JSON all the wayJavascript in the humanitarian world
Who the hell..?我们是谁
Ronan Berder小熊
Makara Wang王浩宇
Wiredcrafthttp://wiredcraft.com
And what do you do?我们做什么
• Data centric apps
• Humanitarian and non-profit space
• In Shanghai and Washington, DC(and soon SF)
Before we get started引言
What’s Reliefweb?Reliefweb是什么
• Re-launched in 2011
• News for the humanitarian world
• Built on Drupal... I know(PHP + MySQL + Sphinx)
What then?客户需求
• Need to innovate
• Built a prototype and pitched it:
User profiles + Mobile
The breakup失败
What happened?为什么
• Fighting the framework
• Performance concerns
• Way too many layers
Back to the whiteboard更高要求
• We need consistency
• We need simplicity
• We need flexibility
• We need speed
And about a million other things...
So, what do we build?目标
Who will save us?救星来了
Why JS?
• Great for a RESTful API
• Great too for a light client
• Other perks; performance, tools...
And... we already know it.
The back-end服务端
Bones for the API什么是 � Bones
• RESTful JSON + OAuth
• Bones = express.js + backbone.jshttps://github.com/developmentseed/bones
• Share models on client and server
Show me the code
</>
And then some more...更多规范
• JSON Schema
• OAuth
• REST
The front-end客户端
Using what we know最流行的
• HTML5 + jQuery mobile + Backbone.js
• Phonegap
• and... Jekyll
Why Jekyll?
• HTML5 apps can get messy
• Jekyll gives us templates & includesAnd we’ll be able to host it on Github pages...
Show me the code
</>
A tiny bit about storage存储方案
Elastic search
• Started with CouchDB
• Now Elastic Search & Redis, because:
• Full text search,
• Document oriented,
• REST API,
Slower, but we don’t care.
Show me the code
</>
A few thoughts少少结论
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
The good stuff好的
• JSON all the way
• Javascript all the way
And performance, tools, community...
What we see我们看到的未来
• The line is getting blurry:
• more fragmentation...
• but more communication
• Loosely coupled systems
Questions?有问题吗?