Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Synth - 東京Node学園2014

pochi
August 20, 2014

Synth - 東京Node学園2014

東京Node学園2014発表資料
Synthの紹介

pochi

August 20, 2014
Tweet

More Decks by pochi

Other Decks in Programming

Transcript

  1. /api/tweets /api/memos back/resources/ tweets/ getTweets.js exports.getIndex = function () {!

    :! } memos/ getMemos.js exports.getIndex = function () {! :! } Directories Backend
  2. exports.getIndex? exports.getIndex = function () {! // GET /api/tweets! }

    exports.get = function () {! // GET /api/tweets/123! } exports.post = function () {! // POST /api/tweet! }
  3. index.jade ! script.! var preloadedData = !{data};! body! h1= appName!

    ! div(ng-view)! ! if preloadHTML! script(type="text/ng-template")! != preloadHTML
  4. getTweets.js ! exports.getIndex = function (db) {! return db.collection('tweets').find()! .sort({

    created_at: -1 })! .limit(30)! .toArray().then(function (tweets) {! return {! tweets: tweets! };! });! };
  5. Synth • is an API-first web application framework • resolves

    initial rendering delays • recommend to use promised handler • have a simple directory - URL mapping