build aHTTP WEB API          w/ nodejs & mongodb
tweet tweet @donnfelker
github.com/donnfelker/workout-tracker
agenda         nodejs         express         mongoose         mongodb
beginner | intermediate
what is   ?
Node.js is a platform built on Chromes JavaScript runtimefor easily building fast, scalable network applications.Node.js u...
standing on the shoulders of giants
how do I build a web api with nodejs?
basic tools   blank slate
expressjs.comexpressweb applicationframework fornode
express()Create an express application.var express = require(express);var app = express();app.get(/, function(req, res){  ...
express()Create an express application.var express = require(express);var app = express();app.get(/, function(req, res){  ...
persistence
what is mongoDB ?
MongoDB (from "humongous") is a scalable, high-performance, open source NoSQL database.                               - mo...
records are stored known as ‘documents’ and resemble json      {          "_id": "4ff09aabf2c99f6cac000006",          "des...
express nodejsmongoosemongodb
mongoosejs.commongoosevar mongoose = require(mongoose);var db = mongoose.createConnection(localhost, workout_tracker);var ...
building the web api
new express projectcreate a folder for the app    mkdir workout-trackercreate a package.json file      {      with these co...
$ npm lsworkout-tracker@0.0.1 /private/tmp!"# express@3.0.0beta7  $"" commander@0.6.1  $"# connect@2.3.9  % $"" bytes@0.1....
ok stop - code time
learn jsthe right way
code      github.com/donnfelker/workout-trackertwitter   @donnfelker          MongoHub
Building HTTP API's with NodeJS and MongoDB
Upcoming SlideShare
Loading in …5
×

Building HTTP API's with NodeJS and MongoDB

3,306 views

Published on

Slide deck for the presentation on building web api's with nodejs and mongodb.

Published in: Technology, Education
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,306
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
89
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Building HTTP API's with NodeJS and MongoDB

    1. 1. build aHTTP WEB API w/ nodejs & mongodb
    2. 2. tweet tweet @donnfelker
    3. 3. github.com/donnfelker/workout-tracker
    4. 4. agenda nodejs express mongoose mongodb
    5. 5. beginner | intermediate
    6. 6. what is ?
    7. 7. Node.js is a platform built on Chromes JavaScript runtimefor easily building fast, scalable network applications.Node.js uses an event-driven, non-blocking I/O model thatmakes it lightweight and efficient, perfect for data-intensivereal-time applications that run across distributed devices. -nodejs.org
    8. 8. standing on the shoulders of giants
    9. 9. how do I build a web api with nodejs?
    10. 10. basic tools blank slate
    11. 11. expressjs.comexpressweb applicationframework fornode
    12. 12. express()Create an express application.var express = require(express);var app = express();app.get(/, function(req, res){ res.send(hello world);});app.listen(3000);
    13. 13. express()Create an express application.var express = require(express);var app = express();app.get(/, function(req, res){ res.json(200, { message : “Hi!” });});app.listen(3000);
    14. 14. persistence
    15. 15. what is mongoDB ?
    16. 16. MongoDB (from "humongous") is a scalable, high-performance, open source NoSQL database. - mongodb.org
    17. 17. records are stored known as ‘documents’ and resemble json { "_id": "4ff09aabf2c99f6cac000006", "description": "21-15-9 of Thrusters and Pull Ups", "name": "Fran", "date_created": "2012-07-01T18:44:59.580Z" }
    18. 18. express nodejsmongoosemongodb
    19. 19. mongoosejs.commongoosevar mongoose = require(mongoose);var db = mongoose.createConnection(localhost, workout_tracker);var schema = mongoose.Schema({ name: string });var Workout = db.model(workout, schema);var w = new Workout({ name: Fran });w.save(function (err) { if (err) // ... res.end(meow);});
    20. 20. building the web api
    21. 21. new express projectcreate a folder for the app mkdir workout-trackercreate a package.json file { with these contents "name": "workout-tracker", "description": "workout tracker app", "version": "0.0.1", "private": true, "dependencies": { "express": "3.x" } } install dependencies and $ npm install install express
    22. 22. $ npm lsworkout-tracker@0.0.1 /private/tmp!"# express@3.0.0beta7 $"" commander@0.6.1 $"# connect@2.3.9 % $"" bytes@0.1.0 % $"" cookie@0.0.4 % $"" crc@0.2.0 % $"" formidable@1.0.11 % !"" qs@0.4.2 $"" cookie@0.0.3 $"" debug@0.7.0 $"" fresh@0.1.0 $"" methods@0.0.1 $"" mkdirp@0.3.3 $"" range-parser@0.0.4 $"# response-send@0.0.1 % !"" crc@0.2.0 !"# send@0.0.3 !"" mime@1.2.6
    23. 23. ok stop - code time
    24. 24. learn jsthe right way
    25. 25. code github.com/donnfelker/workout-trackertwitter @donnfelker MongoHub

    ×