Your SlideShare is downloading. ×
  • Like
Sammy.js: NoSQL, No Problem
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Sammy.js: NoSQL, No Problem

  • 5,197 views
Published

Quick intro to Sammy + NoSQL

Quick intro to Sammy + NoSQL

Published 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,197
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 NoSQL Meetup NYC 10/05/09
  • 2. Sammy.js Sammy is a simple Javascript framework built on top of jQuery.
  • 3. Sammy.js RESTFUL EVENTED JAVASCRIPT
  • 4. Sammy.js 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'); }); }); 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. Database (SQL) Application (Ruby, PHP, Python, etc) Javascript Framework (jQuery) Your $(hit) Frontend Backend Ye Olde Application Architecture
  • 6. Database (NoSQL) DOM Framework (jQuery) Your $(hit) Frontend Backend The NOW JS Router/Controller (Sammy)
  • 7. Sammy.js Sammy is a restful database’s best friend
  • 8. Sammy.js #/ JSON NoSQLJSONHTML/JS
  • 9. Sammy.js 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'); }); }); 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 http://code.quirkey.com/sammy @sammy_js #sammy