Building servers with Node.js

  • 9,823 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
9,823
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
264
Comments
0
Likes
15

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. Building Servers with Node.js Travis Swicegood #nodetalk Licensed under Creative Commons, Attribution, Share-Alike
  • 2. Hi, I’m Travisbuilding servers with node.js some rights reserved
  • 3. #nodetalkbuilding servers with node.js some rights reserved
  • 4. What’s this talk about?building servers with node.js some rights reserved
  • 5. What is Node.js?building servers with node.js some rights reserved
  • 6. Serversbuilding servers with node.js some rights reserved
  • 7. GTDbuilding servers with node.js some rights reserved
  • 8. Is it Right For Me?building servers with node.js some rights reserved
  • 9. What is Node.js?building servers with node.js some rights reserved
  • 10. Evented I/O Networking Toolkitbuilding servers with node.js some rights reserved
  • 11. What’s “evented?”building servers with node.js some rights reserved
  • 12. Some Codebuilding servers with node.js some rights reserved
  • 13. Standard Data Store var db = new Database({host: "localhost"}); db.connect(); var result = db.find({name: "a-post"}); // do something with resultbuilding servers with node.js some rights reserved
  • 14. Evented Data Store var db = new Database({host: "localhost"}); db.connect(function(conn) { conn.find({name: "a-post"}, function(result) { // do something with result }); });building servers with node.js some rights reserved
  • 15. Event Loopbuilding servers with node.js some rights reserved
  • 16. An Analogybuilding servers with node.js some rights reserved
  • 17. A rabbi, a priest, and a cowboy walk into a bar.building servers with node.js some rights reserved
  • 18. Take 1 Simple Bartenderbuilding servers with node.js some rights reserved
  • 19. Rabbibuilding servers with node.js some rights reserved
  • 20. Priestbuilding servers with node.js some rights reserved
  • 21. Cowboy…building servers with node.js some rights reserved
  • 22. … he starts to talkbuilding servers with node.js some rights reserved
  • 23. Bartender is now blockedbuilding servers with node.js some rights reserved
  • 24. Take 2 Evented Bartenderbuilding servers with node.js some rights reserved
  • 25. Rabbibuilding servers with node.js some rights reserved
  • 26. Priestbuilding servers with node.js some rights reserved
  • 27. Cowboy…building servers with node.js some rights reserved
  • 28. … he starts to talkbuilding servers with node.js some rights reserved
  • 29. Bartender starts filling ordersbuilding servers with node.js some rights reserved
  • 30. Fixing Take 1building servers with node.js some rights reserved
  • 31. Add more bartendersbuilding servers with node.js some rights reserved
  • 32. Limit time with each clientbuilding servers with node.js some rights reserved
  • 33. Respond to Eventsbuilding servers with node.js some rights reserved
  • 34. Who uses this?building servers with node.js some rights reserved
  • 35. Nginxbuilding servers with node.js some rights reserved
  • 36. Memcachedbuilding servers with node.js some rights reserved
  • 37. Most NoSQLbuilding servers with node.js some rights reserved
  • 38. Serversbuilding servers with node.js some rights reserved
  • 39. Basic Socket Serverbuilding servers with node.js some rights reserved
  • 40. Echo Server var net = require("net"); net.createServer(function(socket) { socket.on("data", function(data) { socket.write("You said: " + data); socket.end(); }); socket.write("Please say something:n"); }).listen(1234); console.log("Listening on 1234");building servers with node.js some rights reserved
  • 41. Echo Server var net = require("net"); net.createServer(function(socket) { socket.on("data", function(data) { socket.write("You said: " + data); socket.end(); }); socket.write("Please say something:n"); }).listen(1234); console.log("Listening on 1234");building servers with node.js some rights reserved
  • 42. Echo Server var net = require("net"); net.createServer(function(socket) { socket.on("data", function(data) { socket.write("You said: " + data); socket.end(); }); socket.write("Please say something:n"); }).listen(1234); console.log("Listening on 1234");building servers with node.js some rights reserved
  • 43. Echo Server var net = require("net"); net.createServer(function(socket) { socket.on("data", function(data) { socket.write("You said: " + data); socket.end(); }); socket.write("Please say something:n"); }).listen(1234); console.log("Listening on 1234");building servers with node.js some rights reserved
  • 44. Echo Server var net = require("net"); net.createServer(function(socket) { socket.on("data", function(data) { socket.write("You said: " + data); socket.end(); }); socket.write("Please say something:n"); }).listen(1234); console.log("Listening on 1234");building servers with node.js some rights reserved
  • 45. Echo Server var net = require("net"); net.createServer(function(socket) { socket.on("data", function(data) { socket.write("You said: " + data); socket.end(); }); socket.write("Please say something:n"); }).listen(1234); console.log("Listening on 1234");building servers with node.js some rights reserved
  • 46. Echo Server var net = require("net"); net.createServer(function(socket) { socket.on("data", function(data) { socket.write("You said: " + data); socket.end(); }); socket.write("Please say something:n"); }).listen(1234); console.log("Listening on 1234");building servers with node.js some rights reserved
  • 47. Storing Statebuilding servers with node.js some rights reserved
  • 48. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 49. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 50. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 51. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 52. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 53. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 54. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 55. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 56. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 57. Personalized Echo Server net.createServer(function(socket) { var name = false; socket.on("data", function(data) { if (!name) { name = data.toString(utf8).trim(); socket.write("Thanks, " + name + "n"); socket.write("Please say something:n"); } else { socket.write(name + ", you said: " + data); socket.end(); } }); socket.write("Please tell me your name: "); }).listen(1234);building servers with node.js some rights reserved
  • 58. Web Serversbuilding servers with node.js some rights reserved
  • 59. Hello Worldbuilding servers with node.js some rights reserved
  • 60. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 61. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 62. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 63. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 64. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 65. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 66. Something’s Differentbuilding servers with node.js some rights reserved
  • 67. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 68. Hello World var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 69. Any idea why?building servers with node.js some rights reserved
  • 70. Hello World var http = require("http"); http.createServer(function(request, response) { setTimeout(function() { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>Hello, World!</h1>"); response.end(); }, 1000); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 71. Hello World var http = require("http"); http.createServer(function(request, response) { db.find({"slug": "a-blog-post"}, function(post) { response.writeHead(200, {"Content-Type": "text/html"}); response.write("<h1>" + post.title + "</h1>"); response.write(post.body); response.end(); }); }).listen(4321); console.log("Now listening on port 4321");building servers with node.js some rights reserved
  • 72. Grokking the Requestbuilding servers with node.js some rights reserved
  • 73. Output the Requestbuilding servers with node.js some rights reserved
  • 74. Output the Request var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write(require("util").inspect(request)); response.end(); }).listen(4321); console.log("Listening on 4321");building servers with node.js some rights reserved
  • 75. Output the Request var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write(require("util").inspect(request)); response.end(); }).listen(4321); console.log("Listening on 4321");building servers with node.js some rights reserved
  • 76. Output the Request $ curl -s http://localhost:4321/ { socket: { bufferSize: 0, fd: 7, type: tcp4, allowHalfOpen: true, _readWatcher: { socket: [Circular], callback: [Function: onReadable] }, readable: true, _writeQueue: [], _writeQueueEncoding: [], _writeQueueFD: [], … and so on, and so on …building servers with node.js some rights reserved
  • 77. Output the Request $ curl -s http://localhost:4321/ … way down around line 148 … url: /, method: GET,building servers with node.js some rights reserved
  • 78. Output the Request $ curl -s http://localhost:4321/say?msg=Hello | grep "url:" url: /say?msg=Hello,building servers with node.js some rights reserved
  • 79. Parsing the URLbuilding servers with node.js some rights reserved
  • 80. Parsing the URL var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); var parsedUrl = require("url").parse(request.url); response.write(require("util").inspect(parsedUrl)); response.end(); }).listen(4321); console.log("Listening on 4321");building servers with node.js some rights reserved
  • 81. Parsing the URL $ curl -s http://localhost:4321/say?msg=Hello { href: /say?msg=Hello, search: ?msg=Hello, query: msg=Hello, pathname: /say }building servers with node.js some rights reserved
  • 82. Parsing the URL $ curl -s http://localhost:4321/say?msg=Hello { href: /say?msg=Hello, search: ?msg=Hello, query: msg=Hello, pathname: /say }building servers with node.js some rights reserved
  • 83. Parsing the URL $ curl -s http://localhost:4321/say?msg=Hello { href: /say?msg=Hello, search: ?msg=Hello, query: msg=Hello, pathname: /say }building servers with node.js some rights reserved
  • 84. Parsing the URL $ curl -s http://localhost:4321/say?msg=Hello { href: /say?msg=Hello, search: ?msg=Hello, query: msg=Hello, pathname: /say }building servers with node.js some rights reserved
  • 85. Parsing the URL $ curl -s http://localhost:4321/say?msg=Hello { href: /say?msg=Hello, search: ?msg=Hello, query: msg=Hello, pathname: /say }building servers with node.js some rights reserved
  • 86. Parsing the Querybuilding servers with node.js some rights reserved
  • 87. Parsing the Query $ curl -s http://localhost:4321/say?msg=Hello { href: /say?msg=Hello, search: ?msg=Hello, query: msg=Hello, pathname: /say }building servers with node.js some rights reserved
  • 88. Parsing the Query var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); var parsedUrl = require("url").parse(request.url, true); response.write(require("util").inspect(parsedUrl)); response.end(); }).listen(4321); console.log("Listening on 4321");building servers with node.js some rights reserved
  • 89. Parsing the Query var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); var parsedUrl = require("url").parse(request.url, true); response.write(require("util").inspect(parsedUrl)); response.end(); }).listen(4321); console.log("Listening on 4321");building servers with node.js some rights reserved
  • 90. Parsing the Query $ curl -s http://localhost:4321/say?msg=Hello { href: /say?msg=Hello, search: ?msg=Hello, query: { msg: Hello }, pathname: /say }building servers with node.js some rights reserved
  • 91. Receiving Databuilding servers with node.js some rights reserved
  • 92. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 93. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 94. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 95. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 96. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 97. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 98. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 99. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 100. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 101. Receiving Data function(request, response) { var raw = ""; request.on("data", function(chunk) { raw += chunk; }); request.on("end", function() { var data = JSON.parse(raw), obj = {message: data.message.split("").reverse().join("")}; response.writeHead(200, {"Content-Type": "application/json"}); response.write(JSON.stringify(obj)); response.end(); }); }building servers with node.js some rights reserved
  • 102. Something is Wrongbuilding servers with node.js some rights reserved
  • 103. Can’t handle Errors $ node json-reverse.js Listening on 4321 undefined:0 ^ SyntaxError: Unexpected end of input at Object.parse (native) at IncomingMessage.<anonymous> (/Book/code/servers/json- reverse.js:8:21) at IncomingMessage.emit (events.js:39:17) at HTTPParser.onMessageComplete (http.js:111:23) at Socket.ondata (http.js:945:22) at Socket._onReadable (net.js:654:27) at IOWatcher.onReadable [as callback] (net.js:156:10)building servers with node.js some rights reserved
  • 104. Fault-Tolerancebuilding servers with node.js some rights reserved
  • 105. Quick Refactor var handleResponse = function(response, code, message) { response.writeHead(code, {"Content-Type": "application/json"}); response.write(message); response.end(); };building servers with node.js some rights reserved
  • 106. Fault Tolerant Reverse request.on("end", function() { if (!raw) { handleResponse(response, 400, "Requires more data"); return; } try { var data = JSON.parse(raw); } catch(e) { handleResponse(response, 400, "Invalid JSON"); return; } if (!data.message) { handleResponse(response, 400, "Requires a message"); return; } var obj = {message: data.message.split("").reverse().join("") }; handleResponse(response, 200, JSON.stringify(obj)) });building servers with node.js some rights reserved
  • 107. Fault Tolerant Reverse request.on("end", function() { if (!raw) { handleResponse(response, 400, "Requires more data"); return; } try { var data = JSON.parse(raw); } catch(e) { handleResponse(response, 400, "Invalid JSON"); return; } if (!data.message) { handleResponse(response, 400, "Requires a message");building servers with node.js some rights reserved
  • 108. Fault Tolerant Reverse request.on("end", function() { if (!raw) { handleResponse(response, 400, "Requires more data"); return; } try { var data = JSON.parse(raw); } catch(e) { handleResponse(response, 400, "Invalid JSON"); return; } if (!data.message) { handleResponse(response, 400, "Requires a message");building servers with node.js some rights reserved
  • 109. Fault Tolerant Reverse // earlier code } catch(e) { handleResponse(response, 400, "Invalid JSON"); return; } if (!data.message) { handleResponse(response, 400, "Requires a message"); return; } var obj = {message: data.message.split("").reverse().join("") }; handleResponse(response, 200, JSON.stringify(obj)) });building servers with node.js some rights reserved
  • 110. Fault Tolerant Reverse // earlier code } catch(e) { handleResponse(response, 400, "Invalid JSON"); return; } if (!data.message) { handleResponse(response, 400, "Requires a message"); return; } var obj = {message: data.message.split("").reverse().join("") }; handleResponse(response, 200, JSON.stringify(obj)) });building servers with node.js some rights reserved
  • 111. GTDbuilding servers with node.js some rights reserved
  • 112. Libraries Helpbuilding servers with node.js some rights reserved
  • 113. Express visionmedia/expressbuilding servers with node.js some rights reserved
  • 114. Hello World var app = express.createServer(); app.get(/, function(req, res){ res.send(Hello World); }); app.listen(3000);building servers with node.js some rights reserved
  • 115. Socket.IO http://socket.io/building servers with node.js some rights reserved
  • 116. Push from the Server var http = require(http),       io = require(socket.io); var server = http.createServer(function(req, res){  // your normal server code  res.writeHead(200, {Content-Type: text/html});  res.end(<h1>Hello world</h1>); }); server.listen(80);   // socket.io var socket = io.listen(server); socket.on(connection, function(client){   // new client is here!   client.on(message, function(){ … })   client.on(disconnect, function(){ … }) });building servers with node.js some rights reserved
  • 117. Socket.IO // socket.io var socket = io.listen(server); socket.on(connection, function(client){   // new client is here!   client.on(message, function(){ … })   client.on(disconnect, function(){ … }) });building servers with node.js some rights reserved
  • 118. Sending to Client // socket.io var socket = io.listen(server); socket.on(connection, function(client) { // send a message back to the client client.send({msg: "Thanks for connecting…"}); // broadcast a message to everyone client.broadcast({msg: "Another one connected!"}); });building servers with node.js some rights reserved
  • 119. CoffeeScript jashkenas/coffee-scriptbuilding servers with node.js some rights reserved
  • 120. Remember this code? request.on("end", function() { if (!raw) { handleResponse(response, 400, "Requires more data"); return; } try { var data = JSON.parse(raw); } catch(e) { handleResponse(response, 400, "Invalid JSON"); return; } if (!data.message) { handleResponse(response, 400, "Requires a message"); return; } var obj = {message: data.message.split("").reverse().join("") }; handleResponse(response, 200, JSON.stringify(obj)) });building servers with node.js some rights reserved
  • 121. In CoffeeScript request.on "end", () -> return handleResponse response, 400, "Requires more data" unless raw try data = JSON.parse raw catch e return handleResponse response, 400, "Requires more data" return handleResponse response, 400, "Requires a message" unless data.message obj = message: data.message.split("").reverse().join("") handleResponse response, 200, JSON.stringify objbuilding servers with node.js some rights reserved
  • 122. Vows cloudhead/vows http://vowjs.org/building servers with node.js some rights reserved
  • 123. No Samplesbuilding servers with node.js some rights reserved
  • 124. Is it Right For Me?building servers with node.js some rights reserved
  • 125. It Dependsbuilding servers with node.js some rights reserved
  • 126. The Checklistbuilding servers with node.js some rights reserved
  • 127. Control the Stackbuilding servers with node.js some rights reserved
  • 128. Comfortable with Changebuilding servers with node.js some rights reserved
  • 129. Full Control Over App Logicbuilding servers with node.js some rights reserved
  • 130. Lots of Small Independent Piecesbuilding servers with node.js some rights reserved
  • 131. Then Maybebuilding servers with node.js some rights reserved
  • 132. Where to?building servers with node.js some rights reserved
  • 133. nodejs.orgbuilding servers with node.js some rights reserved
  • 134. #Node.js (freenode)building servers with node.js some rights reserved
  • 135. Travis Swicegood travisswicegood.com @tswicegood travis@domain51.com http://joind.in/2810building servers with node.js some rights reserved