• Like

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Sammy.js: NoSQL, No Problem

  • 5,164 views
Uploaded on

Quick intro to Sammy + NoSQL

Quick intro to Sammy + NoSQL

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Very interesting looking -- reminds of me of Nitrogen (erl) and Sinatra (rb) but in js. Could work real well with CouchDB, but CouchApp is another framework that implements a minimal CouchDB JS web app framework; it's just not signal routing the way frameworks like these are. Makes me a bit more partial to this and eager to play around with it.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
5,164
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
72
Comments
1
Likes
8

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Sammy.js NOSQL, NO PROBLEM
  • 2. Sammy.js Sammy is a simple Javascript framework built on top of jQuery.
  • 3. Sammy.js RESTFUL EVENTED JAVASCRIPT
  • 4. var app = $.sammy(function(app) { this.use(Sammy.Template); var db = loadDatabase(); this.get('#/', function(context) { this.pages = db.allDocs(function(docs) { context.docs = docs; context.partial('index.template'); }); }); Sammy.js this.get('#/page/:id', function(context) { this.page = db.getDoc(this.params.id, function(doc) { context.doc = doc; doc.partial('page.template'); }); }); this.post('#/page/:id', function(context) { db.saveDoc(this.params.id, this.params, function(doc) { context.doc = doc; context.partial('page.template'); }); }); });
  • 5. Ye Olde Application Architecture Your $(hit) Javascript Framework (jQuery) Frontend Application (Ruby, PHP, Python, etc) Backend Database (SQL)
  • 6. The NOW Your $(hit) JS Router/Controller (Sammy) Frontend DOM Framework (jQuery) Database Backend (NoSQL)
  • 7. Sammy.js Sammy is a restful database’s best friend
  • 8. #/ JSON HTML/JS Sammy.js JSON NoSQL
  • 9. var app = $.sammy(function(app) { this.use(Sammy.Template); var db = loadDatabase(); this.get('#/', function(context) { this.pages = db.allDocs(function(docs) { context.docs = docs; context.partial('index.template'); }); }); Sammy.js this.get('#/page/:id', function(context) { this.page = db.getDoc(this.params.id, function(doc) { context.doc = doc; doc.partial('page.template'); }); }); this.post('#/page/:id', function(context) { db.saveDoc(this.params.id, this.params, function(doc) { context.doc = doc; context.redirect('#', 'page', doc.id); }); }); });
  • 10. Sammy.js ‣ TINY ‣ TESTED ‣ WELL DOCUMENTED ‣ SIMPLE API ‣ EXTENSIBLE
  • 11. Sammy.js