From 707b902b08054cacf852a1c88dd1d9b11eb334eb Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 21:55:28 -0400 Subject: [PATCH 1/9] [dist] Bump dependency versions. --- package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 798106e..cf19725 100644 --- a/package.json +++ b/package.json @@ -9,14 +9,15 @@ }, "keywords": ["bookmarks", "webservice", "tutorial", "nodejs"], "dependencies": { - "cradle": "0.5.x", + "cradle": "0.6.x", "journey": ">= 0.4.0-pre", "http-console": "0.6.x", - "optimist": "0.2.x", - "winston": "0.5.x" + "optimist": "0.4.x", + "winston": "0.7.x" }, "devDependencies": { - "vows": "0.5.x", + "api-easy": "~0.3.8", + "vows": "0.7.x", "request": "2.x.x" }, "scripts": { From 0b1fe1c00785b01b254944db06f5d01dda2335b5 Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 21:58:07 -0400 Subject: [PATCH 2/9] [refactor] Remove references to `require.paths`. --- test/00getting-started/pinpoint-api-easy-test.js | 2 +- test/00getting-started/pinpoint-test.js | 2 +- test/helpers.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/00getting-started/pinpoint-api-easy-test.js b/test/00getting-started/pinpoint-api-easy-test.js index a62ab27..5f9cd91 100644 --- a/test/00getting-started/pinpoint-api-easy-test.js +++ b/test/00getting-started/pinpoint-api-easy-test.js @@ -7,7 +7,7 @@ var vows = require('vows'), helpers.addPinpoint('00getting-started'); -var pinpoint = require('pinpoint'); +var pinpoint = require('../../lib/00getting-started/pinpoint'); var tests = APIeasy.describe('00getting-started'); diff --git a/test/00getting-started/pinpoint-test.js b/test/00getting-started/pinpoint-test.js index b86a1e1..c3dd5fb 100644 --- a/test/00getting-started/pinpoint-test.js +++ b/test/00getting-started/pinpoint-test.js @@ -7,7 +7,7 @@ var vows = require('vows'), helpers.addPinpoint('00getting-started'); -var pinpoint = require('pinpoint'); +var pinpoint = require('../../lib/00getting-started/pinpoint'); vows.describe('00getting-started').addBatch(helpers.requiresInit(8000)).addBatch({ "A request to the pinpoint server": { diff --git a/test/helpers.js b/test/helpers.js index d69e5a0..7b40cf0 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -2,11 +2,11 @@ var helpers = exports; var assert = require('assert'), + path = require('path'), pinpoint; helpers.addPinpoint = function (target) { - require.paths.unshift(require('path').join(__dirname, '..', 'lib', target)); - pinpoint = require('pinpoint'); + pinpoint = require(path.join(__dirname, '..', 'lib', target, 'pinpoint')); }; helpers.requiresInit = function (port) { From 61ae52385211a3391c4fa610b8ffb5aa21708abc Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 22:13:04 -0400 Subject: [PATCH 3/9] [refactor] Replace `journey` with `director`. --- README.md | 4 +- lib/00getting-started/pinpoint.js | 2 +- lib/01routing/service.js | 27 ++++--- lib/02couchdb/service.js | 40 +++++----- lib/03authentication/helpers.js | 14 ++-- lib/03authentication/service.js | 117 +++++++++++++++--------------- package.json | 10 +-- 7 files changed, 110 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index 75264df..0f608d5 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # nodejs-intro -My introduction presentation to node.js along with sample code at various stages of building a simple RESTful web service with journey, cradle, winston, optimist, and http-console. +My introduction presentation to node.js along with sample code at various stages of building a simple RESTful web service with director, cradle, winston, optimist, and http-console. #### Author: [Charlie Robbins](http://twitter.com/indexzero) -[0]: http://github.com/cloudhead/journey +[0]: http://github.com/flatiron/director [1]: http://github.com/cloudhead/cradle [2]: http://github.com/indexzero/winston [3]: http://github.com/substack/node-optimist diff --git a/lib/00getting-started/pinpoint.js b/lib/00getting-started/pinpoint.js index 6131f60..4860227 100644 --- a/lib/00getting-started/pinpoint.js +++ b/lib/00getting-started/pinpoint.js @@ -40,4 +40,4 @@ exports.createServer = function (port) { exports.start = function (options, callback) { var server = exports.createServer(options.port); callback(null, server); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/01routing/service.js b/lib/01routing/service.js index f6b958d..f024e4e 100644 --- a/lib/01routing/service.js +++ b/lib/01routing/service.js @@ -6,52 +6,51 @@ * */ -var journey = require('journey'); +var director = require('director'); /** * Creates the RESTful router for the pinpoint web service */ exports.createRouter = function () { - var router = new (journey.Router)({ + var router = new director.http.Router().configure({ strict: false, - strictUrls: false, - api: 'basic' + async: true }); router.path(/\/bookmarks/, function () { // // LIST: GET to /bookmarks lists all bookmarks // - this.get().bind(function (res) { - res.send(501, {}, { action: 'list' }); + this.get(function () { + this.res.send(501, {}, { action: 'list' }); }); // // SHOW: GET to /bookmarks/:id shows the details of a specific bookmark // - this.get(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) { - res.send(501, {}, { action: 'show' }); + this.get(/\/([\w|\d|\-|\_]+)/, function (id) { + this.res.json(501, { action: 'show' }); }); // // CREATE: POST to /bookmarks creates a new bookmark // - this.post().bind(function (res, bookmark) { - res.send(501, {}, { action: 'create' }); + this.post(function (bookmark) { + this.res.json(501, { action: 'create' }); }); // // UPDATE: PUT to /bookmarks updates an existing bookmark // - this.put(/\/([\w|\d|\-|\_]+)/).bind(function (res, bookmark) { - res.send(501, {}, { action: 'update' }); + this.put(/\/([\w|\d|\-|\_]+)/, function (bookmark) { + this.res.json(501, { action: 'update' }); }); // // DELETE: DELETE to /bookmarks/:id deletes a specific bookmark // - this.del(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) { - res.send(501, {}, { action: 'delete' }); + this.del(/\/([\w|\d|\-|\_]+)/, function (id) { + this.res.json(501, { action: 'delete' }); }); }); diff --git a/lib/02couchdb/service.js b/lib/02couchdb/service.js index 13c6799..c8e6a40 100644 --- a/lib/02couchdb/service.js +++ b/lib/02couchdb/service.js @@ -6,7 +6,7 @@ * */ -var journey = require('journey'), +var director = require('director'), helpers = require('./helpers'); /** @@ -14,62 +14,65 @@ var journey = require('journey'), * @param {bookmark} resource: Instance of a bookmark resource */ exports.createRouter = function (resource) { - var router = new (journey.Router)({ + var router = new director.http.Router().configure({ strict: false, - strictUrls: false, - api: 'basic' + async: true }); router.path(/\/bookmarks/, function () { // // LIST: GET to /bookmarks lists all bookmarks // - this.get().bind(function (res) { + this.get(function () { + var res = this.res; resource.list(function (err, bookmarks) { if (err) { - return res.send(500, {}, { error: err.error }); + return res.json(500, { error: err.error }); } - res.send(200, {}, { bookmarks: bookmarks }); + res.json(200, { bookmarks: bookmarks }); }); }); // // SHOW: GET to /bookmarks/:id shows the details of a specific bookmark // - this.get(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) { + this.get(/\/([\w|\d|\-|\_]+)/, function (id) { + var res = this.res; resource.show(id, function (err, bookmark) { if (err) { - return res.send(500, {}, { error: err.error }); + return res.json(500, { error: err.error }); } - res.send(200, {}, { bookmark: bookmark }); + res.json(200, { bookmark: bookmark }); }); }); // // CREATE: POST to /bookmarks creates a new bookmark // - this.post().bind(function (res, bookmark) { + this.post(function (bookmark) { + var res = this.res; resource.create(bookmark, function (err, result) { if (err) { - return res.send(500, {}, { error: err.error }); + return res.json(500, { error: err.error }); } - res.send(200, {}, { bookmark: result }); + res.json(200, { bookmark: result }); }); }); // // UPDATE: PUT to /bookmarks updates an existing bookmark // - this.put(/\/([\w|\d|\-|\_]+)/).bind(function (res, id, bookmark) { + this.put(/\/([\w|\d|\-|\_]+)/, function (id, bookmark) { + var res = this.res; resource.update(id, bookmark, function (err, updated) { if (err) { - return res.send(500, {}, { error: err.error }); + return res.json(500, { error: err.error }); } - res.send(200, {}, { updated: updated }); + res.json(200, { updated: updated }); }); }); @@ -77,12 +80,13 @@ exports.createRouter = function (resource) { // DELETE: DELETE to /bookmarks/:id deletes a specific bookmark // this.del(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) { + var res = this.res; resource.destroy(id, function (err, destroyed) { if (err) { - return res.send(500, {}, { error: err.error }); + return res.json(500, { error: err.error }); } - res.send(200, {}, { destroyed: destroyed }); + res.json(200, { destroyed: destroyed }); }); }); }); diff --git a/lib/03authentication/helpers.js b/lib/03authentication/helpers.js index d767a36..b399edb 100644 --- a/lib/03authentication/helpers.js +++ b/lib/03authentication/helpers.js @@ -6,7 +6,7 @@ * */ -var journey = require('journey'); +var director = require('director'); /** * randomString returns a pseude-random ASCII string which contains at least the specified number of bits of entropy @@ -51,7 +51,7 @@ var auth = exports.auth = { authorization = request.headers.authorization; if (!authorization) { - return callback(new journey.NotAuthorized("Authorization header is required.")); + return callback(new director.http.NotAuthorized("Authorization header is required.")); } var parts = authorization.split(" "), // Basic salkd787&u34n= @@ -59,13 +59,13 @@ var auth = exports.auth = { credentials = base64.decode(parts[1]).split(":"); // admin:password if (scheme !== "Basic") { - return callback(new journey.NotAuthorized("Authorization scheme must be 'Basic'")); + return callback(new director.http.NotAuthorized("Authorization scheme must be 'Basic'")); } - else if(!credentials[0] && !credentials[1]){ - return callback(new journey.NotAuthorized("Both username and password are required")); + else if (!credentials[0] && !credentials[1]){ + return callback(new director.http.NotAuthorized("Both username and password are required")); } - else if(credentials[0] !== auth.username || credentials[1] !== auth.password) { - return callback(new journey.NotAuthorized("Invalid username or password")); + else if (credentials[0] !== auth.username || credentials[1] !== auth.password) { + return callback(new director.http.NotAuthorized("Invalid username or password")); } // Respond with no error if username and password match diff --git a/lib/03authentication/service.js b/lib/03authentication/service.js index 6aa4176..25efda2 100644 --- a/lib/03authentication/service.js +++ b/lib/03authentication/service.js @@ -6,7 +6,7 @@ * */ -var journey = require('journey'), +var director = require('director'), helpers = require('./helpers'); /** @@ -14,84 +14,87 @@ var journey = require('journey'), * @param {bookmark} resource: Instance of a bookmark resource */ exports.createRouter = function (resource) { - var router = new (journey.Router)({ + var router = new director.http.Router().configure({ strict: false, - strictUrls: false, - api: 'basic', - filter: helpers.auth.basicAuth + async: true }); + + // + // Authentication: Add a before() method to perform HTTP Basic Auth + // + router.before(/\/bookmarks/, helpers.auth.basicAuth); // // Resource: Bookmarks // router.path(/\/bookmarks/, function () { // - // Authentication: Add a filter() method to perform HTTP Basic Auth + // LIST: GET to /bookmarks lists all bookmarks // - this.filter(function () { - // - // LIST: GET to /bookmarks lists all bookmarks - // - this.get().bind(function (res) { - resource.list(function (err, bookmarks) { - if (err) { - return res.send(500, {}, { error: err.error }); - } + this.get(function () { + var res = this.res; + resource.list(function (err, bookmarks) { + if (err) { + return res.json(500, { error: err.error }); + } - res.send(200, {}, { bookmarks: bookmarks }); - }); + res.json(200, { bookmarks: bookmarks }); }); + }); - // - // SHOW: GET to /bookmarks/:id shows the details of a specific bookmark - // - this.get(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) { - resource.show(id, function (err, bookmark) { - if (err) { - return res.send(500, {}, { error: err.error }); - } + // + // SHOW: GET to /bookmarks/:id shows the details of a specific bookmark + // + this.get(/\/([\w|\d|\-|\_]+)/, function (id) { + var res = this.res; + resource.show(id, function (err, bookmark) { + if (err) { + return res.json(500, { error: err.error }); + } - res.send(200, {}, { bookmark: bookmark }); - }); + res.json(200, { bookmark: bookmark }); }); + }); - // - // CREATE: POST to /bookmarks creates a new bookmark - // - this.post().bind(function (res, bookmark) { - resource.create(bookmark, function (err, result) { - if (err) { - return res.send(500, {}, { error: err.error }); - } + // + // CREATE: POST to /bookmarks creates a new bookmark + // + this.post(, function (bookmark) { + var res = this.res; + resource.create(bookmark, function (err, result) { + if (err) { + return res.json(500, { error: err.error }); + } - res.send(200, {}, { bookmark: result }); - }); + res.json(200, { bookmark: result }); }); + }); - // - // UPDATE: PUT to /bookmarks updates an existing bookmark - // - this.put(/\/([\w|\d|\-|\_]+)/).bind(function (res, id, bookmark) { - resource.update(id, bookmark, function (err, updated) { - if (err) { - return res.send(500, {}, { error: err.error }); - } + // + // UPDATE: PUT to /bookmarks updates an existing bookmark + // + this.put(/\/([\w|\d|\-|\_]+)/, function (id, bookmark) { + var res = this.res; + resource.update(id, bookmark, function (err, updated) { + if (err) { + return res.json(500, { error: err.error }); + } - res.send(200, {}, { updated: updated }); - }); + res.json(200, { updated: updated }); }); + }); - // - // DELETE: DELETE to /bookmarks/:id deletes a specific bookmark - // - this.del(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) { - resource.destroy(id, function (err, destroyed) { - if (err) { - return res.send(500, {}, { error: err.error }); - } + // + // DELETE: DELETE to /bookmarks/:id deletes a specific bookmark + // + this.del(/\/([\w|\d|\-|\_]+)/, function (id) { + var res = this.res; + resource.destroy(id, function (err, destroyed) { + if (err) { + return res.json(500, { error: err.error }); + } - res.send(200, {}, { destroyed: destroyed }); - }); + res.json(200, { destroyed: destroyed }); }); }); }); diff --git a/package.json b/package.json index cf19725..3b330e5 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { "name": "nodejs-intro", - "description": "My introduction presentation to node.js along with sample code at various stages of building a simple RESTful web service with journey, cradle, winston, optimist, and http-console.", + "description": "My introduction presentation to node.js along with sample code at various stages of building a simple RESTful web service with director, cradle, winston, optimist, and http-console.", "version": "0.1.3", "author": "Charlie Robbins ", "repository": { - "type": "git", - "url": "http://github.com/indexzero/nodejs-intro.git" + "type": "git", + "url": "http://github.com/indexzero/nodejs-intro.git" }, "keywords": ["bookmarks", "webservice", "tutorial", "nodejs"], "dependencies": { "cradle": "0.6.x", - "journey": ">= 0.4.0-pre", + "director": "~1.2.0", "http-console": "0.6.x", "optimist": "0.4.x", "winston": "0.7.x" @@ -25,5 +25,5 @@ }, "bin": { "nodejs-intro": "./bin/server" }, "main": "./lib/03authentication/pinpoint", - "engines": { "node": ">= 0.4.0" } + "engines": { "node": ">= 0.6.0" } } From 3ee83c3dbee212dbbd107c39a77ea1988ee7d94f Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 23:31:58 -0400 Subject: [PATCH 4/9] [refactor] Remove forward facing code. --- bin/server | 40 ------------ lib/00getting-started/pinpoint.js | 43 ------------- lib/01routing/pinpoint.js | 53 --------------- lib/01routing/service.js | 58 ----------------- lib/02couchdb/bookmark.js | 102 ----------------------------- lib/02couchdb/database.js | 53 --------------- lib/02couchdb/helpers.js | 32 ---------- lib/02couchdb/pinpoint.js | 68 -------------------- lib/02couchdb/service.js | 95 --------------------------- lib/03authentication/bookmark.js | 102 ----------------------------- lib/03authentication/database.js | 53 --------------- lib/03authentication/helpers.js | 74 --------------------- lib/03authentication/pinpoint.js | 77 ---------------------- lib/03authentication/service.js | 103 ------------------------------ 14 files changed, 953 deletions(-) delete mode 100755 bin/server delete mode 100644 lib/00getting-started/pinpoint.js delete mode 100644 lib/01routing/pinpoint.js delete mode 100644 lib/01routing/service.js delete mode 100644 lib/02couchdb/bookmark.js delete mode 100644 lib/02couchdb/database.js delete mode 100644 lib/02couchdb/helpers.js delete mode 100644 lib/02couchdb/pinpoint.js delete mode 100644 lib/02couchdb/service.js delete mode 100644 lib/03authentication/bookmark.js delete mode 100644 lib/03authentication/database.js delete mode 100644 lib/03authentication/helpers.js delete mode 100644 lib/03authentication/pinpoint.js delete mode 100644 lib/03authentication/service.js diff --git a/bin/server b/bin/server deleted file mode 100755 index aabc8eb..0000000 --- a/bin/server +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env node - -var util = require('util'), - path = require('path'), - argv = require('optimist').argv; - -var help = [ - "usage: server [options]", - "", - "Runs the demo pinpoint server at the appropriate stage in development", - "", - "options:", - " -p Port that you want the home server to run on [8000]", - " -t, --target Target stage for pinpoint development [00getting-started]", - " -s, --setup Indicates we should configure the database first [false]", - " -a, --auth user:password combo to use for HTTP Basic Auth [none]", - " -h, --help You're staring at it", -].join('\n'); - -if (argv.h || argv.help) { - return util.puts(help); -} - -var target, options = { - port: argv.p || 8000, - setup: argv.s || argv.setup || false, - basicAuth: argv.a || argv.auth || null -}; - -target = argv.t || argv.target || '00getting-started'; - -var pinpoint = require(path.join('..', 'lib', target, 'pinpoint')); -pinpoint.start(options, function (err, server) { - if (err) { - return util.puts('Error starting pinpoint server: ' + err.message); - } - - util.puts('Pinpoint demo server listening for ' + target + ' on http://127.0.0.1:' + options.port); -}); - diff --git a/lib/00getting-started/pinpoint.js b/lib/00getting-started/pinpoint.js deleted file mode 100644 index 4860227..0000000 --- a/lib/00getting-started/pinpoint.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * pinpoint.js: Top-level include for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var http = require('http'), - winston = require('winston'); - -/** - * Creates the server for the pinpoint web service - * @param {int} port: Port for the server to run on - */ -exports.createServer = function (port) { - var server = http.createServer(function (request, response) { - var data = ''; - - winston.info('Incoming Request', { url: request.url }); - - request.on('data', function (chunk) { - data += chunk; - }); - - response.writeHead(501, { 'Content-Type': 'application/json' }); - response.end(JSON.stringify({ message: 'not implemented' })); - }); - - if (port) { - server.listen(port); - } - - return server; -}; - -/** - * Light-weight wrapped to 'createServer' method for future use - */ -exports.start = function (options, callback) { - var server = exports.createServer(options.port); - callback(null, server); -}; \ No newline at end of file diff --git a/lib/01routing/pinpoint.js b/lib/01routing/pinpoint.js deleted file mode 100644 index a23bff9..0000000 --- a/lib/01routing/pinpoint.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * pinpoint.js: Top-level include for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var http = require('http'), - winston = require('winston'), - service = require('./service'); - -/** - * Creates the server for the pinpoint web service - * @param {int} port: Port for the server to run on - */ -exports.createServer = function (port) { - var router = service.createRouter(); - - var server = http.createServer(function (request, response) { - var body = ''; - - winston.info('Incoming Request', { url: request.url }); - - request.on('data', function (chunk) { - body += chunk; - }); - - request.on('end', function () { - // - // Dispatch the request to the router - // - router.handle(request, body, function (route) { - response.writeHead(route.status, route.headers); - response.end(route.body); - }); - }) - }); - - if (port) { - server.listen(port); - } - - return server; -}; - -/** - * Light-weight wrapped to 'createServer' method for future use - */ -exports.start = function (options, callback) { - var server = exports.createServer(options.port); - callback(null, server); -} \ No newline at end of file diff --git a/lib/01routing/service.js b/lib/01routing/service.js deleted file mode 100644 index f024e4e..0000000 --- a/lib/01routing/service.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * service.js: Defines the web service for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var director = require('director'); - -/** - * Creates the RESTful router for the pinpoint web service - */ -exports.createRouter = function () { - var router = new director.http.Router().configure({ - strict: false, - async: true - }); - - router.path(/\/bookmarks/, function () { - // - // LIST: GET to /bookmarks lists all bookmarks - // - this.get(function () { - this.res.send(501, {}, { action: 'list' }); - }); - - // - // SHOW: GET to /bookmarks/:id shows the details of a specific bookmark - // - this.get(/\/([\w|\d|\-|\_]+)/, function (id) { - this.res.json(501, { action: 'show' }); - }); - - // - // CREATE: POST to /bookmarks creates a new bookmark - // - this.post(function (bookmark) { - this.res.json(501, { action: 'create' }); - }); - - // - // UPDATE: PUT to /bookmarks updates an existing bookmark - // - this.put(/\/([\w|\d|\-|\_]+)/, function (bookmark) { - this.res.json(501, { action: 'update' }); - }); - - // - // DELETE: DELETE to /bookmarks/:id deletes a specific bookmark - // - this.del(/\/([\w|\d|\-|\_]+)/, function (id) { - this.res.json(501, { action: 'delete' }); - }); - }); - - return router; -}; \ No newline at end of file diff --git a/lib/02couchdb/bookmark.js b/lib/02couchdb/bookmark.js deleted file mode 100644 index cbffc80..0000000 --- a/lib/02couchdb/bookmark.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * bookmark.js: Top-level include for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var helpers = require('./helpers'); - -/** -* Constructor function for the Bookmark object.. -* @constructor -* @param {connection} database: Connection to CouchDB -*/ -var Bookmark = exports.Bookmark = function (database) { - this.database = database; -}; - -/** -* Lists all Bookmarks in the database -* @param {function} callback: Callback function -*/ -Bookmark.prototype.list = function (callback) { - this.database.view('Bookmark/all', function (err, result) { - if (err) { - return callback(err); - } - - callback(null, result.rows.map(function (row) { return row.value })); - }) -}; - -/** -* Shows details of a particular bookmark -* @param {string} id: ID of the bookmark -* @param {function} callback: Callback function -*/ -Bookmark.prototype.show = function (id, callback) { - this.database.get(id, function (err, doc) { - if (err) { - return callback(err); - } - - callback(null, doc); - }); -}; - -/** -* Creates a new bookmark with the specified properties -* @param {object} bookmark: Properties to use for the bookmark -* @param {function} callback: Callback function -*/ -Bookmark.prototype.create = function (bookmark, callback) { - bookmark._id = helpers.randomString(32); - bookmark.resource = "Bookmark"; - - this.database.save(bookmark._id, bookmark, function (err, res) { - if (err) { - return callback(err); - } - - callback(null, bookmark); - }) -}; - -/** -* Updates a new bookmark with the specified id and properties -* @param {object} bookmark: Properties to update the bookmark with -* @param {function} callback: Callback function -*/ -Bookmark.prototype.update = function (id, bookmark, callback) { - this.database.merge(id, bookmark, function (err, res) { - if (err) { - return callback(err); - } - - callback(null, true); - }); -}; - -/** -* Destroys a bookmark with the specified ID -* @param {string} id: ID of the bookmark to destroy -* @param {function} callback: Callback function -*/ -Bookmark.prototype.destroy = function (id, callback) { - var self = this; - this.show(id, function (err, doc) { - if (err) { - return callback(err); - } - - self.database.remove(id, doc._rev, function (err, res) { - if (err) { - return callback(err); - } - - callback(null, true); - }); - }); -}; \ No newline at end of file diff --git a/lib/02couchdb/database.js b/lib/02couchdb/database.js deleted file mode 100644 index 88149c6..0000000 --- a/lib/02couchdb/database.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * database.js: Configuration for CouchDB and cradle for this application. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var cradle = require('cradle'); - -var setup = exports.setup = function (options, callback) { - // Set connection configuration - cradle.setup({ - host: options.host || '127.0.0.1', - port: 5984, - options: options.options, - }); - - // Connect to cradle - var conn = new (cradle.Connection)({ auth: options.auth }), - db = conn.database(options.database || 'pinpoint-dev'); - - if (options.setup) { - initViews(db, callback); - } - else { - callback(null, db); - } -}; - -var initViews = exports.initViews = function (db, callback) { - var designs = [ - { - '_id': '_design/Bookmark', - views: { - all: { - map: function (doc) { if (doc.resource === 'Bookmark') emit(doc._id, doc) } - }, - byUrl: { - map: function (doc) { if (doc.resource === 'Bookmark') { emit(doc.url, doc); } } - }, - byDate: { - map: function (doc) { if (doc.resource === 'Bookmark') { emit(doc.date, doc); } } - } - } - } - ]; - - db.save(designs, function (err) { - if (err) return callback(err); - callback(null, db); - }); -}; \ No newline at end of file diff --git a/lib/02couchdb/helpers.js b/lib/02couchdb/helpers.js deleted file mode 100644 index 73a2581..0000000 --- a/lib/02couchdb/helpers.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * helpers.js: Helper functions for the pinpoint web service. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -/** - * randomString returns a pseude-random ASCII string which contains at least the specified number of bits of entropy - * the return value is a string of length ⌈bits/6⌉ of characters from the base64 alphabet - * @param {int} bits: Number of bits to use for the randomString - * - */ -var randomString = exports.randomString = function (bits) { - var chars, rand, i, ret; - - chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; - ret = ''; - - // in v8, Math.random() yields 32 pseudo-random bits (in spidermonkey it gives 53) - while (bits > 0) { - // 32-bit integer - rand = Math.floor(Math.random() * 0x100000000); - // base 64 means 6 bits per character, so we use the top 30 bits from rand to give 30/6=5 characters. - for (i = 26; i > 0 && bits > 0; i -= 6, bits -= 6) { - ret += chars[0x3F & rand >>> i]; - } - } - - return ret; -}; \ No newline at end of file diff --git a/lib/02couchdb/pinpoint.js b/lib/02couchdb/pinpoint.js deleted file mode 100644 index 125a101..0000000 --- a/lib/02couchdb/pinpoint.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * pinpoint.js: Top-level include for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var http = require('http'), - winston = require('winston'), - database = require('./database'), - bookmark = require('./bookmark'), - service = require('./service'); - -/** - * Creates the server for the pinpoint web service - * @param {int} port: Port for the server to run on - * @param {connection} database: Connection to CouchDB - */ -exports.createServer = function (port, database) { - var resource = new bookmark.Bookmark(database), - router = service.createRouter(resource); - - var server = http.createServer(function (request, response) { - var body = ''; - - winston.info('Incoming Request', { url: request.url }); - - request.on('data', function (chunk) { - body += chunk; - }); - - request.on('end', function () { - // - // Dispatch the request to the router - // - var emitter = router.handle(request, body, function (route) { - response.writeHead(route.status, route.headers); - response.end(route.body); - }); - - emitter.on('log', function (info) { - winston.info('Request completed', info); - }); - }) - }); - - if (port) { - server.listen(port); - } - - return server; -}; - -/** - * Creates the server for the pinpoint web service - * @param {int} port: Port for the server to run on - * @param {connection} database: Connection to CouchDB - */ -exports.start = function (options, callback) { - database.setup(options, function (err, db) { - if (err) { - return callback(err); - } - - callback(null, exports.createServer(options.port, db)); - }); -}; \ No newline at end of file diff --git a/lib/02couchdb/service.js b/lib/02couchdb/service.js deleted file mode 100644 index c8e6a40..0000000 --- a/lib/02couchdb/service.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * service.js: Defines the web service for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var director = require('director'), - helpers = require('./helpers'); - -/** - * Creates the RESTful router for the pinpoint web service - * @param {bookmark} resource: Instance of a bookmark resource - */ -exports.createRouter = function (resource) { - var router = new director.http.Router().configure({ - strict: false, - async: true - }); - - router.path(/\/bookmarks/, function () { - // - // LIST: GET to /bookmarks lists all bookmarks - // - this.get(function () { - var res = this.res; - resource.list(function (err, bookmarks) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { bookmarks: bookmarks }); - }); - }); - - // - // SHOW: GET to /bookmarks/:id shows the details of a specific bookmark - // - this.get(/\/([\w|\d|\-|\_]+)/, function (id) { - var res = this.res; - resource.show(id, function (err, bookmark) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { bookmark: bookmark }); - }); - }); - - // - // CREATE: POST to /bookmarks creates a new bookmark - // - this.post(function (bookmark) { - var res = this.res; - resource.create(bookmark, function (err, result) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { bookmark: result }); - }); - }); - - // - // UPDATE: PUT to /bookmarks updates an existing bookmark - // - this.put(/\/([\w|\d|\-|\_]+)/, function (id, bookmark) { - var res = this.res; - resource.update(id, bookmark, function (err, updated) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { updated: updated }); - }); - }); - - // - // DELETE: DELETE to /bookmarks/:id deletes a specific bookmark - // - this.del(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) { - var res = this.res; - resource.destroy(id, function (err, destroyed) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { destroyed: destroyed }); - }); - }); - }); - - return router; -}; \ No newline at end of file diff --git a/lib/03authentication/bookmark.js b/lib/03authentication/bookmark.js deleted file mode 100644 index cbffc80..0000000 --- a/lib/03authentication/bookmark.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * bookmark.js: Top-level include for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var helpers = require('./helpers'); - -/** -* Constructor function for the Bookmark object.. -* @constructor -* @param {connection} database: Connection to CouchDB -*/ -var Bookmark = exports.Bookmark = function (database) { - this.database = database; -}; - -/** -* Lists all Bookmarks in the database -* @param {function} callback: Callback function -*/ -Bookmark.prototype.list = function (callback) { - this.database.view('Bookmark/all', function (err, result) { - if (err) { - return callback(err); - } - - callback(null, result.rows.map(function (row) { return row.value })); - }) -}; - -/** -* Shows details of a particular bookmark -* @param {string} id: ID of the bookmark -* @param {function} callback: Callback function -*/ -Bookmark.prototype.show = function (id, callback) { - this.database.get(id, function (err, doc) { - if (err) { - return callback(err); - } - - callback(null, doc); - }); -}; - -/** -* Creates a new bookmark with the specified properties -* @param {object} bookmark: Properties to use for the bookmark -* @param {function} callback: Callback function -*/ -Bookmark.prototype.create = function (bookmark, callback) { - bookmark._id = helpers.randomString(32); - bookmark.resource = "Bookmark"; - - this.database.save(bookmark._id, bookmark, function (err, res) { - if (err) { - return callback(err); - } - - callback(null, bookmark); - }) -}; - -/** -* Updates a new bookmark with the specified id and properties -* @param {object} bookmark: Properties to update the bookmark with -* @param {function} callback: Callback function -*/ -Bookmark.prototype.update = function (id, bookmark, callback) { - this.database.merge(id, bookmark, function (err, res) { - if (err) { - return callback(err); - } - - callback(null, true); - }); -}; - -/** -* Destroys a bookmark with the specified ID -* @param {string} id: ID of the bookmark to destroy -* @param {function} callback: Callback function -*/ -Bookmark.prototype.destroy = function (id, callback) { - var self = this; - this.show(id, function (err, doc) { - if (err) { - return callback(err); - } - - self.database.remove(id, doc._rev, function (err, res) { - if (err) { - return callback(err); - } - - callback(null, true); - }); - }); -}; \ No newline at end of file diff --git a/lib/03authentication/database.js b/lib/03authentication/database.js deleted file mode 100644 index 88149c6..0000000 --- a/lib/03authentication/database.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * database.js: Configuration for CouchDB and cradle for this application. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var cradle = require('cradle'); - -var setup = exports.setup = function (options, callback) { - // Set connection configuration - cradle.setup({ - host: options.host || '127.0.0.1', - port: 5984, - options: options.options, - }); - - // Connect to cradle - var conn = new (cradle.Connection)({ auth: options.auth }), - db = conn.database(options.database || 'pinpoint-dev'); - - if (options.setup) { - initViews(db, callback); - } - else { - callback(null, db); - } -}; - -var initViews = exports.initViews = function (db, callback) { - var designs = [ - { - '_id': '_design/Bookmark', - views: { - all: { - map: function (doc) { if (doc.resource === 'Bookmark') emit(doc._id, doc) } - }, - byUrl: { - map: function (doc) { if (doc.resource === 'Bookmark') { emit(doc.url, doc); } } - }, - byDate: { - map: function (doc) { if (doc.resource === 'Bookmark') { emit(doc.date, doc); } } - } - } - } - ]; - - db.save(designs, function (err) { - if (err) return callback(err); - callback(null, db); - }); -}; \ No newline at end of file diff --git a/lib/03authentication/helpers.js b/lib/03authentication/helpers.js deleted file mode 100644 index b399edb..0000000 --- a/lib/03authentication/helpers.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * helpers.js: Helper functions for the pinpoint web service. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var director = require('director'); - -/** - * randomString returns a pseude-random ASCII string which contains at least the specified number of bits of entropy - * the return value is a string of length ⌈bits/6⌉ of characters from the base64 alphabet - * @param {int} bits: Number of bits to use for the randomString - * - */ -var randomString = exports.randomString = function (bits) { - var chars, rand, i, ret; - - chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; - ret = ''; - - // in v8, Math.random() yields 32 pseudo-random bits (in spidermonkey it gives 53) - while (bits > 0) { - // 32-bit integer - rand = Math.floor(Math.random() * 0x100000000); - // base 64 means 6 bits per character, so we use the top 30 bits from rand to give 30/6=5 characters. - for (i = 26; i > 0 && bits > 0; i -= 6, bits -= 6) { - ret += chars[0x3F & rand >>> i]; - } - } - - return ret; -}; - -var base64 = exports.base64 = { - encode: function (unencoded) { - return new Buffer(unencoded || '').toString('base64'); - }, - - decode: function (encoded) { - return new Buffer(encoded || '', 'base64').toString('utf8'); - }, -}; - -var auth = exports.auth = { - username: 'admin', - password: 'password', - basicAuth: function (request, body, callback) { - var realm = "Authorization Required", - authorization = request.headers.authorization; - - if (!authorization) { - return callback(new director.http.NotAuthorized("Authorization header is required.")); - } - - var parts = authorization.split(" "), // Basic salkd787&u34n= - scheme = parts[0], // Basic - credentials = base64.decode(parts[1]).split(":"); // admin:password - - if (scheme !== "Basic") { - return callback(new director.http.NotAuthorized("Authorization scheme must be 'Basic'")); - } - else if (!credentials[0] && !credentials[1]){ - return callback(new director.http.NotAuthorized("Both username and password are required")); - } - else if (credentials[0] !== auth.username || credentials[1] !== auth.password) { - return callback(new director.http.NotAuthorized("Invalid username or password")); - } - - // Respond with no error if username and password match - callback(null); - } -}; \ No newline at end of file diff --git a/lib/03authentication/pinpoint.js b/lib/03authentication/pinpoint.js deleted file mode 100644 index 46e3526..0000000 --- a/lib/03authentication/pinpoint.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * pinpoint.js: Top-level include for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var util = require('util'), - http = require('http'), - winston = require('winston'), - database = require('./database'), - bookmark = require('./bookmark'), - helpers = require('./helpers'), - service = require('./service'); - -/** - * Creates the server for the pinpoint web service - * @param {int} port: Port for the server to run on - * @param {connection} database: Connection to CouchDB - */ -exports.createServer = function (port, database) { - var resource = new bookmark.Bookmark(database), - router = service.createRouter(resource); - - var server = http.createServer(function (request, response) { - var body = ''; - - winston.info('Incoming Request', { url: request.url }); - - request.on('data', function (chunk) { - body += chunk; - }); - - request.on('end', function () { - // - // Dispatch the request to the router - // - var emitter = router.handle(request, body, function (route) { - response.writeHead(route.status, route.headers); - response.end(route.body); - }); - - emitter.on('log', function (info) { - winston.info('Request completed', info); - }); - }) - }); - - if (port) { - server.listen(port); - } - - return server; -}; - -/** - * Creates the server for the pinpoint web service - * @param {int} port: Port for the server to run on - * @param {connection} database: Connection to CouchDB - */ -exports.start = function (options, callback) { - database.setup(options, function (err, db) { - if (err) { - return callback(err); - } - - if (options.basicAuth) { - var auth = options.basicAuth.split(':'); - helpers.auth.username = auth[0]; - helpers.auth.password = auth[1]; - util.puts('Configuring HTTP Basic Auth. Base64 Encoded Username/Password: ' + helpers.base64.encode(auth[0] + ':' + auth[1])); - } - - callback(null, exports.createServer(options.port, db)); - }); -}; \ No newline at end of file diff --git a/lib/03authentication/service.js b/lib/03authentication/service.js deleted file mode 100644 index 25efda2..0000000 --- a/lib/03authentication/service.js +++ /dev/null @@ -1,103 +0,0 @@ -/* - * service.js: Defines the web service for the Pinpoint module. - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var director = require('director'), - helpers = require('./helpers'); - -/** - * Creates the RESTful router for the pinpoint web service - * @param {bookmark} resource: Instance of a bookmark resource - */ -exports.createRouter = function (resource) { - var router = new director.http.Router().configure({ - strict: false, - async: true - }); - - // - // Authentication: Add a before() method to perform HTTP Basic Auth - // - router.before(/\/bookmarks/, helpers.auth.basicAuth); - - // - // Resource: Bookmarks - // - router.path(/\/bookmarks/, function () { - // - // LIST: GET to /bookmarks lists all bookmarks - // - this.get(function () { - var res = this.res; - resource.list(function (err, bookmarks) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { bookmarks: bookmarks }); - }); - }); - - // - // SHOW: GET to /bookmarks/:id shows the details of a specific bookmark - // - this.get(/\/([\w|\d|\-|\_]+)/, function (id) { - var res = this.res; - resource.show(id, function (err, bookmark) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { bookmark: bookmark }); - }); - }); - - // - // CREATE: POST to /bookmarks creates a new bookmark - // - this.post(, function (bookmark) { - var res = this.res; - resource.create(bookmark, function (err, result) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { bookmark: result }); - }); - }); - - // - // UPDATE: PUT to /bookmarks updates an existing bookmark - // - this.put(/\/([\w|\d|\-|\_]+)/, function (id, bookmark) { - var res = this.res; - resource.update(id, bookmark, function (err, updated) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { updated: updated }); - }); - }); - - // - // DELETE: DELETE to /bookmarks/:id deletes a specific bookmark - // - this.del(/\/([\w|\d|\-|\_]+)/, function (id) { - var res = this.res; - resource.destroy(id, function (err, destroyed) { - if (err) { - return res.json(500, { error: err.error }); - } - - res.json(200, { destroyed: destroyed }); - }); - }); - }); - - return router; -}; \ No newline at end of file From 49e3ebf7b1e71c3cb532ac5aacbca749e03a5d4c Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 23:32:54 -0400 Subject: [PATCH 5/9] [refactor] Start at "hello world". --- lib/hello-node.js => bin/server | 2 ++ 1 file changed, 2 insertions(+) rename lib/hello-node.js => bin/server (93%) mode change 100644 => 100755 diff --git a/lib/hello-node.js b/bin/server old mode 100644 new mode 100755 similarity index 93% rename from lib/hello-node.js rename to bin/server index 8204547..c3eed7a --- a/lib/hello-node.js +++ b/bin/server @@ -1,3 +1,5 @@ +#!/usr/bin/env node + // A simple ‘hello world’ server in node.js var sys = require('sys'), http = require('http'); From f707c8e7492922a1ae81141813aae1ff46d4d2a3 Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 23:33:10 -0400 Subject: [PATCH 6/9] [refactor test] Remove forward facing code. --- .../pinpoint-api-easy-test.js | 19 ------------ test/00getting-started/pinpoint-test.js | 29 ------------------- test/helpers.js | 23 --------------- 3 files changed, 71 deletions(-) delete mode 100644 test/00getting-started/pinpoint-api-easy-test.js delete mode 100644 test/00getting-started/pinpoint-test.js delete mode 100644 test/helpers.js diff --git a/test/00getting-started/pinpoint-api-easy-test.js b/test/00getting-started/pinpoint-api-easy-test.js deleted file mode 100644 index 5f9cd91..0000000 --- a/test/00getting-started/pinpoint-api-easy-test.js +++ /dev/null @@ -1,19 +0,0 @@ - - -var vows = require('vows'), - assert = require('assert'), - APIeasy = require('api-easy'), - helpers = require('./../helpers'); - -helpers.addPinpoint('00getting-started'); - -var pinpoint = require('../../lib/00getting-started/pinpoint'); - -var tests = APIeasy.describe('00getting-started'); - -tests.suite.addBatch(helpers.requiresInit(8000)); - -tests.use('localhost', 8000) - .get().expect(501, { message: 'not implemented' }) - .export(module); - diff --git a/test/00getting-started/pinpoint-test.js b/test/00getting-started/pinpoint-test.js deleted file mode 100644 index c3dd5fb..0000000 --- a/test/00getting-started/pinpoint-test.js +++ /dev/null @@ -1,29 +0,0 @@ - - -var vows = require('vows'), - assert = require('assert'), - request = require('request'), - helpers = require('./../helpers'); - -helpers.addPinpoint('00getting-started'); - -var pinpoint = require('../../lib/00getting-started/pinpoint'); - -vows.describe('00getting-started').addBatch(helpers.requiresInit(8000)).addBatch({ - "A request to the pinpoint server": { - topic: function () { - request({ - uri: 'http://localhost:8000/', - method: 'GET' - }, this.callback); - }, - "should respond with 501 - Not implemented": function (err, res, body) { - assert.isNull(err); - assert.equal(res.statusCode, 501); - }, - "should respond with 'not implemented'": function (err, res, body) { - assert.isNull(err); - assert.equal(JSON.parse(body).message, 'not implemented'); - } - } -}).export(module); \ No newline at end of file diff --git a/test/helpers.js b/test/helpers.js deleted file mode 100644 index 7b40cf0..0000000 --- a/test/helpers.js +++ /dev/null @@ -1,23 +0,0 @@ - -var helpers = exports; - -var assert = require('assert'), - path = require('path'), - pinpoint; - -helpers.addPinpoint = function (target) { - pinpoint = require(path.join(__dirname, '..', 'lib', target, 'pinpoint')); -}; - -helpers.requiresInit = function (port) { - return { - "This test requires pinpoint.start": { - topic: function () { - pinpoint.start({ env: 'test', port: port }, this.callback); - }, - "should respond without an error": function (err, server) { - assert.isNull(err); - } - } - }; -} \ No newline at end of file From ccd800c071fa8447b6c35ae84fceb6cb8345ca04 Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 23:11:34 -0400 Subject: [PATCH 7/9] [dist] Added .travis.yml. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8111245 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 \ No newline at end of file From 1381e401ce5985c964cb319c008cbb296cecb4b2 Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 23:34:29 -0400 Subject: [PATCH 8/9] [refactor] Removed unused parts of package.json --- package.json | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/package.json b/package.json index 3b330e5..c561ce7 100644 --- a/package.json +++ b/package.json @@ -8,22 +8,6 @@ "url": "http://github.com/indexzero/nodejs-intro.git" }, "keywords": ["bookmarks", "webservice", "tutorial", "nodejs"], - "dependencies": { - "cradle": "0.6.x", - "director": "~1.2.0", - "http-console": "0.6.x", - "optimist": "0.4.x", - "winston": "0.7.x" - }, - "devDependencies": { - "api-easy": "~0.3.8", - "vows": "0.7.x", - "request": "2.x.x" - }, - "scripts": { - "test": "vows --spec --isolate" - }, "bin": { "nodejs-intro": "./bin/server" }, - "main": "./lib/03authentication/pinpoint", "engines": { "node": ">= 0.6.0" } } From 20d1b58786a0a98b8dda10570e9579c56d07e3c2 Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 15 May 2013 23:35:49 -0400 Subject: [PATCH 9/9] [dist] Bump version to `1.0.0-hellonode`. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c561ce7..0032a88 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nodejs-intro", "description": "My introduction presentation to node.js along with sample code at various stages of building a simple RESTful web service with director, cradle, winston, optimist, and http-console.", - "version": "0.1.3", + "version": "1.0.0-hellonode", "author": "Charlie Robbins ", "repository": { "type": "git",