Git Product home page Git Product logo

practicalnode's Introduction

Practical Node.js, 2nd Edition [Apress, 2018]

JavaScript Style Guide

JavaScript Style Guide

This is the manuscript (draft) and code for Practical Node.js, 2nd Edition [Apress, 2018]. It's work in progress and the draft will be completed in the end of 2017. For the code of the 1st edition, please visit 1st-edition.

You can get final 2nd edition (pre-order now or buy when it's ready) at Apress: http://www.apress.com/us/book/9781484230381 or Amazon.

Practical Node.js, 1st Edition 1st Edition [2014]

Practical Node.js, 2nd Edition 2nd Edition [2018]

https://amzn.to/2QsUucg

Book, Rights and Publishing

Practical Node, 2nd Edition is a work-in-open book. It means that the book is written, updated and previewed in this repository as free-to-read drafts, but are also being professionally edited, typeset, designed, produced, published, printed in soft cover and distributed to physical and electronic stores through the reputable tech publisher, Apress Media.

If you find the content here useful in any form, I request that you get the printed version of the book or a professionally produced Kindle, ePUB or PDF copy of the book. If you want to support me and Apress to create more work-in-open projects like Practical Node, 2nd Edition, please purchase the books once they are available for sale, through your normal physical or electronic book stores.

If you'd like to contribute financially towards the effort (or any of my other open source work) aside from purchasing the books, or hire me as a speaker, write a message to me via my blog, or through Twitter, Facebook or LinkedIn.

Practical Node.js, 2nd Edition Table of Contents [NEEDS REVIEW! 👀]

  1. Setting up Node.js and Other Essentials [2nd Edition]
  2. Using Express.js 4 to Create Node.js Web Apps [2nd Edition]
  3. TDD and BDD for Node.js with Mocha [2nd Edition]
  4. Template Engines: Pug and Handlebars [2nd Edition]
  5. Persistence with MongoDB and Mongoskin [2nd Edition]
  6. Using Sessions and OAuth to Authorize and Authenticate Users in Node.js Apps [2nd Edition]
  7. Boosting Node.js and MongoDB with Mongoose [2nd Edition]
  8. Building Node.js REST API Servers with Express.js and Hapi [2nd Edition]
  9. Real-Time Apps with WebSocket, Socket.IO, and DerbyJS [2nd Edition]
  10. Getting Node.js Apps Production Ready [2nd Edition]
  11. Deploying Node.js Apps [2nd Edition]
  12. Publishing Node.js Modules and Contributing to Open Source [2nd Edition]
  13. Node HTTP/2 Servers BRAND NEW
  14. Asynchronous Code in Node BRAND NEW
  15. Node Microservices with Docker and AWS ECS BRAND NEW
  16. Serverless Node with AWS Lambda BRAND NEW

Note: It's work in progress (Transition from 1st to 2nd edition) and the draft will be completed in the end of 2017. Check out [2nd Edition] for newer updated content.

Help Needed

The help is needed in the following areas:

  • Provide ideas, topics, new chapters, project, suggestions for 3rd edition in GitHub issues - NOW
  • Review 3rd edition for typos (copy editing) when it's ready
  • Review 3rd edition from a tech perspective (tech editing) when it's ready
  • Review and run updated the code for 3rd edition when it's ready

Live Corporate Training

Practical Node is a work of 30+ in-person courses, workshops and classes delivered by me in-person at various companies (Walmart Labs, Cisco, Intuit, Starbucks, Capital One, OnDeck, HubSpot, VMWare to name just a few), dev schools (Hack Reactor, DevBootcamp, Flat Iron NY, etc.) and conferences (ForwardJS, Node Interactive and others). If you need a corporate remote/online or onsite in-person training delivered by me, then send me a message.

Live Public Training

NodeProgram.com is the place to find out about next live (remote/online) and in-person workshops/seminars/classes.

Self-Paced Training

Node University is the ultimate, most comprehensive and complete resource on Node.js and full stack JavaScript. View free self-paced courses or view all self-paced courses.

Contribution

TBD

Supporters

Practical Node, 2nd Edition was supported through the Kickstarter campaign (funded in just three days). Thank you to the major backers of the book:

  • DevelopIntelligence: Managed learning solutions including training design and development, program delivery and management - $500
  • Matthew Amacker - $200
  • Jordan Horiuchi - $200
  • Tim Chen - $175
  • Alexey Bushnev - $175
  • Aleksey Maksimov - $175
  • Maurice van Cooten - $175
  • Ryan - $175
  • Ng Yao Min - $175
  • Kommana Karteek - $160
  • Elias Yousef - $150
  • Arhuman - $150
  • Javier Armendariz - $150
  • Dave Anderson - $150
  • Edithson Abelard - $150
  • Ron Male - $145
  • Win - $145
  • Harold Avilez - $145
  • Moe Joe - $145
  • Guest 1871315922 - $145
  • Philipp Jauss - $145
  • Judy Herilla - $145
  • Jaydev Dhinoja - $145
  • Carlos Rodriguez - $145
  • Pak - $145
  • Jim Texter - $145
  • David Wolff - $145
  • German Yesid Rubiano Romero - $125
  • shannon Johnstone - $125
  • Mani Rana - $125
  • Jeff Anderson - $125
  • Tajinder Pal Singh - $125
  • Sridhar Domakonda - $125
  • Dieter - $125
  • Felix Wang - $125
  • Dan Jensen - $125
  • Joel Register - $125
  • Edgar Sanchez - $125
  • Alexey - $125
  • Peter Sjölin - $125
  • Sksamy - $125
  • Manuel Padrón Martínez - $125
  • William Bartholomew - $125
  • Sukesh Kumar Dash - $125
  • Ross Matthews - $125
  • Elaine David - $125
  • Phil Aylesworth - $125
  • 張大寶 - $125
  • Vishnu - $125
  • Jonathan Jou - $125
  • Ernest Weems - $125
  • Allen Lam - $125
  • Martinerko - $125
  • Sharif H. Khan - $125
  • Larry Statham - $125
  • Syllie - $125
  • Eric J. - $125
  • Jim Tyhurst - $125
  • Oliver Schoenborn - $125
  • Benjamin Sweetnam - $75
  • Ian Partridge - $75
  • Hafeez Syed - $75
  • Chuck Huie - $75
  • Thomas Greenhalgh - $75
  • Sanghee Kim - $75
  • JoeL Ivey - $75
  • Clifford Lum - $75
  • Ben Altieri - $75
  • Patrick - $75
  • Mani S - $75
  • Simon St-Germain - $75
  • Jaiyaramakrishnan Mahendran - $75
  • Kevin Youkhana - $75
  • Eymard Ventura - $75
  • Matt Braun - $75
  • Brent - $75
  • Helio Alves - $75
  • Matthew Winter - $75
  • Omar Gómez Figueroa - $75
  • Herwin Rey - $75
  • Laura Steiner - $75
  • Ben Manning - $75
  • David le Blanc - $75
  • Brian Chirgwin - $75
  • Cédric Donner - $75
  • Gary Poon - $75
  • Mitchell Harpur - $75
  • Beardsley Ruml - $50
  • Swanand Kriyaban - $50
  • Suhas - $50
  • Yong Seok Jeon - $50
  • Martin Moellenbeck - $45
  • Mikael Wallin - $45
  • Aakash Jain - $35
  • Alexandru Nedel - $35
  • John Bond - $35
  • Michael Patrick R. Flores - $35
  • Lou Yufan - $35
  • Creative Area - $35
  • Chew Chit Siang - $35
  • Yuri Oliveira - $35
  • Khoa Nguyen - $35
  • Piti Champeethong - $35
  • Siim Orasmäe - $25
  • Jorge Ordoñez Mendez - $25
  • Tim Goshinski - $25

Practical Node.js, 1st Edition (Apress, 2014)

practicalnode's People

Contributors

angelogulina avatar art-kan avatar azat-co avatar behroozk avatar biblicalph avatar crisz avatar daniel-vera-g avatar elijahahianyo avatar emirsavran avatar georgyserga avatar ihak avatar joosem avatar junboz avatar m-ketan avatar m4jing avatar monkindey avatar prahaladbelavadi avatar rautility avatar realize096 avatar rorra avatar user135711 avatar vijaybhaskar184 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  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

practicalnode's Issues

ch5 (book-git) - Mocha test fails on mismatching articles.json in the book and the git source

If one:

  • has two projects, one coded from the book (book project) and another one from git (git project)
  • runs ./db/seed.sh from the git project.
  • runs make test from the book project.

then one test will fail because the first article in the book ends with to improve network coverage... and it does not match the string from the git project to improve network coverage.

Possible solution is to finish the article sentence in the book with a dot, even when the strings are longer.

CH 3 - Mocha tests fails

I'm using the index.js and app.js raw code from git hub to run the mocha test. I'm recieving a timeout and failure when testing.
package

chapter3mochafail
appjs
indexjs

ch 2 - Routes in Express.js

I'm a bit confused by this section. After "However, it's trivial to write your own middleware..." well, an example of a middleware to route by query string arguments is given. And then it says: "The request handler itself (index.js, in this case) is straightforward".

What index.js? The example was not mentioned as being in an index.js file. After all, is an example of something not included in express cli generated project. Is it the index.js in the routes folder? The one shown later is actually users.js.

invalid path

The following path 'chapter1/media/Homebrew is causing the git checkout to fail and therefore the cloning succeeds but deletes the contents right after.

Trying to use newest versions of modules, having difficulty.

Is there anybody who can explain how to go about updating this to the newest versions of each module? I installed them, and got the server running, but then when I try to visit the port, I get some errors. If anybody's tried this, and could share their experience, I'd appreciate that.

400 Error: request size did not match content length

http://stackoverflow.com/questions/26922125/node-js-post-causes-error

0 down vote favorite

I am running this app. the only change is twitter consumer key and secret I made in app.js file

I can run this app and sign-in with twitter. But when I try to post an article it causes error.

Connect
400 Error: request size did not match content length

at makeError (/home/myname/Documents/nodejs/practicalnode/ch7/blog-express/node_modules/body-parser/node_modules/raw-body/index.js:136:15)
at IncomingMessage.onEnd (/home/myname/Documents/nodejs/practicalnode/ch7/blog-express/node_modules/body-parser/node_modules/raw-body/index.js:106:13)
at IncomingMessage.g (events.js:180:16)
at IncomingMessage.emit (events.js:92:17)
at _stream_readable.js:938:16
at process._tickCallback (node.js:419:13)

What should I check?what could be wrong. thanks

ch6 (git) - http://localhost:3000/auth/twitter returns 500 error

Using the source code from git and the recommended start.sh from the book, when I try to sign in with Twitter, I get a 500 error from Express. (Key, Secret and Twitter name are set)

Console output:

starting step - getRequestToken
undefined
GET /auth/twitter 500 5898ms

Replace Grunt example

Replace Grunt example with Webpack (Hot Module Replacement) in code and text (chapter 10)

chapt 1 prototypal typo

https://github.com/azat-co/practicalnode/blob/master/chapter1/chapter1.md#prototypal-nature

var user = function (ops) {
  return { firstName: ops.name || 'John'
         , lastName: ops.name || 'Doe'
         , email: ops.email || '[email protected]'
         , name: function() { return this.firstName + this.lastName}
         }
}

var agency = function(ops) {
  ops = ops || {}
  var agency = user(ops)
  agency.customers = ops.customers || 0
  agency.isAgency = true
  return agency
}

should be

var user = function (ops) {
  return { firstName: ops.firstName || 'John'
         , lastName: ops.lastName || 'Doe'
         , email: ops.email || '[email protected]'
         , name: function() { return this.firstName + this.lastName}
         }
}

var agency = function(ops) {
  ops = ops || {}
  var agency = user(ops)
  agency.customers = ops.customers || 0
  agency.isAgency = true
  return agency
}

ch5 (book) - missing scripts/css download description

In the book, there is no mention how to download the javascripts/css files, e.g. bower install bootstrap#3.0.2 and bower install jquery#2.0.3. And if one follows the coding instructions without checking out the git source code, one does not see the final UI.

Also missing documentation: how to compile styl files to css. (e.g. stylus -w public/css/style.styl)

ch5 (git) - mongo-skin.js - TypeError: Object #<SkinClass> has no method 'findOneAndAddText'

Moving the file mongo-skin.js to the folder blog-express/ and running node mongo-skin.js gives the following error:

(Using Node.js v0.10.31 and mongoDB 2.6.4)

db.collection('messages').findOneAndAddText('hi', function(count, id){
                          ^
TypeError: Object #<SkinClass> has no method 'findOneAndAddText'
    at Object.<anonymous> (/.../practicalnode/ch5/blog-express/mongo-skin.js:26:27)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

NEW TOPICS

Please vote on these topics to be included into the 2nd edition:

  • http/2
  • SSL
  • NAPI (native modules)
  • async/await, promises
  • crypto
  • Ethereum, dapps, web3
  • React Native
  • Electron
  • Webpack
  • ES6 modules in Node
  • Babel
  • Docker
  • AWS
  • k8s
  • Axios
  • Fetch API (node fetch npm module)
  • GraphQL server
  • TypeScript or Flow
  • Yarn

Admin Delete Button Calls both Remove & Update functions

This section of code in admin.js calls both remove and update functions, causing a 500 server error because the document gets deleted and when the update function runs it tries to edit a document that doesn't exist.

$(document.ready(function(){
var $element = $('.admin tbody');
$element.on('click','button.remove', remove);
$element.on('click','button', update);
}

I had to change it to:

$element.on('click', 'button.remove', remove);
$element.on('click', 'button.publish', update);
$element.on('click', 'button.unpublish', update);

I'm sure there is a better way to do this

Typos / Miscellaneous Erata in Kindle Version

  • Chapter 1 (location 873 of 8083) link to "http://callbackhell.com/):" broken
  • Chapter 2 (location 1564 of 8083) reference to process.evn.PORT instead of process.env.PORT
  • Chapter 2 (location 1652 of 8083) Missing opening h1 tag:
"Produces the following HTML code: hello </h1><p>Welcome to the Practical Node.js!</p>" 
  • Chapter 4 (location 2412 of 8083)
    Quote: "hence the name of the library (see the resemblance to handlebars on a bicycle?".
    Handlebars is named as such because it is a nickname for an impressive mustache. It has nothing to do with handlebars on a bicycle.
  • Chapter 8 (location 5014 of 8083): refers to "Anglers JS" instead of "Angular JS".
  • Chapter 8 (location 5465 of 8083): section title says "Hapi RESP API..." instead of "Hapi REST API..."
  • Chapter 9 (Location 5779): example of of "full source code" of browser websocket implementation is missing error handler (ws.onerror = function(event){...} ).

serverless examples use outdated dynamodb-doc

A note in its repository says:

As of September 10, 2015, this version of the Document SDK will be deprecated in favor of the AWS.DynamoDB.DocumentClient in the official AWS SDK for JavaScript

I believe examples should be updated...

chapter 6 /auth/twitter HTTP 500 error

I'm having the same issue as in #5

I have set my consumer key and consumer secret as appropriate in Makefile

Could you please go through what settings/permissions the Twitter app requires?

Even a very short and simple step-by-step of creating the app and setting up the permissions would be enough to get this working so we can continue reading the book!

chapter 3 test error

the end's callback function is always be passed two arguments err and response; if no error occurred, the first argument will be null;

request
.get('..')
.end(function(err, res){

});

Tech review all chapters

  • code is working
  • text make sense
  • code is consistent between files and text and in style (standardJS)

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.