Git Product home page Git Product logo

nodejsbook.io.examples's Introduction

Code Examples for Sams Teach Yourself Node.js in 24 Hours

This repository is a series of examples to support the Sam's Teach Yourself Node.js in 24 Hours book.

The book may be purchased from Amazon.

If you find any inconsistencies or code that doesn't run as expected please open an issue.

The book contains examples written with Express 2.x. Since the book was released Express 3 has been released. The code examples here have been updated to run on Express 3 so please refer to the code examples here rather than the code in the book.

  • Part I: Getting Started
    1. Introducing Node.js
    2. Node Package Manager
    3. What Node.js Is For
    4. Callbacks
  • Part II: Basic Websites With Node.js 5. HTTP 6. Introducing Express 7. More on Express 8. Persisting data
  • Part III: Debugging, Testing and Deploying 9. Debugging Node.js Application 10. Testing Node.js Applications 11. Deploying Node.js applications
  • Part IV: Intermediate Sites With Node.js 12. Introducting Socket.IO 13. A Socket.IO Chat Server 14. A Streaming Twitter Client 15. JSON APIs
  • Part V: Exploring The Node.js API 16. The Process Module 17. The Child Process Module 18. The Events Module 19. The Buffer Module 20. The Stream Module
  • Part VI: Further Node.js Development 21. CoffeeScript 22. Creating Node.js Modules 23. Creating Middleware With Connect 24. Using Node.js With Backbone.js

nodejsbook.io.examples's People

Contributors

shapeshed avatar svnlto avatar vishwanthini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejsbook.io.examples's Issues

Mongo data validation Hour 8, Ex. 11

Hi George,

I have a hunch part of the validation process is no longer valid. It doesn't gracefully log the validation issue, but rather pops a message thus: "ValidationError: Validator "a task is required" failed for path task with value ``"

Pretty sure this isn't right - but I get it even after using the downloaded code for example 11. Is it possible the framework has changed since the book was published?

Kind Regards,
Andrew.

Chapter 8, layout.jade

Really enjoying your book. For some reason layout.jade isn't working in chapter 8. Maybe a different version of Express?

via Twitter @joshhostels

hour17/example04

I've a problem with the hour17/example04. When I kill one of the child
processes from a second terminal window, I don't get the result of the
Figure 17.3. The console doesn't inform of the process kill, nor the
start of the new child process. Is there any error in the code? I've
tested in Mac and Windows (using the taskkill /F /PID XXXX command).

Hour08 Example04

Error: failed to connect to [localhost:27017]

Anyone experienced the same???

Hour14, Example 3-6

Running the examples with Node.js version 0.10.16 required some minor changes.

The version of Express in package.json needed to be:

"express":"3.1.0"

The initial part of app.js needs to change to:

var app = require('express')(),
    server = require('http').createServer(app),
    twitter = require('ntwitter'),
    io = require('socket.io').listen(server);

server.listen(3000);

With that, the examples run great. Thanks for putting this book out there!

Twitter bootstrap links dead?

I'm wondering if the rapid upgrades to twitter bootstrap mean the links to 1.4.0 are now defunct. I'm not seeing any bootstrap styling in the Hour 8 examples when I link to 1.4

Fantastic book by the way! Love it. As an old c hacker, a lot of the web concepts are new. The book is perfect for somebody with coding experience but lacking some of the newer web expertise. Brilliant!

Cheers,
Andrew.

SORTED: UPDATED THE LINKS TO BOOTSTRAP 3, ALL GOOD (but a few class names have changed)

hour13 example04 running error with callback function undefined

Hi George,

I got the following error on the hour13 example 4 of your book, I put it as the following, who define the callback function?

Thanks,
Y.H. Chang

C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04>node ap
p.js
info - socket.io started
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 18904434431555541341
debug - setting request GET /socket.io/1/websocket/18904434431555541341
debug - set heartbeat interval for client 18904434431555541341
debug - client authorized for
debug - websocket writing 1::

C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04\app.js:
16
callback(true);
^
TypeError: undefined is not a function
at Socket. (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_node
js\hour13\example04\app.js:16:7)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (C:\1yh\download\bk\JavaScript\node_js_Redis
\tysf_nodejs\hour13\example04\node_modules\socket.io\lib\namespace.js:335:22)
at Manager.onClientMessage (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf
_nodejs\hour13\example04\node_modules\socket.io\lib\manager.js:459:38)
at WebSocket.Transport.onMessage (C:\1yh\download\bk\JavaScript\node_js_Redi
s\tysf_nodejs\hour13\example04\node_modules\socket.io\lib\transport.js:387:20)
at Parser. (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_node
js\hour13\example04\node_modules\socket.io\lib\transports\websocket\hybi-16.js:4
0:10)
at Parser.EventEmitter.emit (events.js:93:17)
at opcodeHandlers.1.finish (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf
_nodejs\hour13\example04\node_modules\socket.io\lib\transports\websocket\hybi-16
.js:286:16)
at Parser.opcodeHandlers.1.expectData [as expectHandler](C:1yhdownloadbk
JavaScriptnode_js_Redistysf_nodejshour13example04node_modulessocket.ioli
btransportswebsockethybi-16.js:297:15)
at Parser.add (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour1
3\example04\node_modules\socket.io\lib\transports\websocket\hybi-16.js:464:24)

C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04>

hour02/example02 - README.md

'Examine package.json to understand how to delcare dependencies'

should be

'Examine package.json to understand how to declare dependencies'

ntwitter gives error, it is unmaintained

When running example 1 from hour 14, I get:

Error: Uncaught, unspecified "error" event.
at Error (native)
at EventEmitter.emit (events.js:87:13)
at ClientRequest. (/home/tolik/express_twitter/node_modules/ntwitter/lib/twitter.js:251:14)
at ClientRequest.emit (events.js:107:17)
at HTTPParser.parserOnIncomingClient as onIncoming
at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
at TLSSocket.socketOnData (_http_client.js:309:20)
at TLSSocket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:161:16)
at TLSSocket.Readable.push (_stream_readable.js:125:10)
tolik@tolik-VirtualBox:~/express_twitter$ node app.js
events.js:87
throw Error('Uncaught, unspecified "error" event.');

The same error is reported on ntwitter AvianFlu/ntwitter#146 . The only suggested solution to sync server clock did not help. Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.