2016 年最值得读的 10 篇 Nodejs 文章
2016 was an exciting year for Node.js developers. I mean - just take a look at this picture:
Looking back through the 6-year-long history of Node.js, we can tell that our favorite framework has finally matured to be used by the greatest enterprises, from all around the world, in basically every industry.
Another great news is that Node.js is the biggest open source platform ever - with 15 million+ downloads/month and more than a billion package downloads/week. Contributions have risen to the top as well since now we have more than 1,100 developers who built Node.js into the platform it is now.
To summarize this year, we collected the 10 most important articles we recommend to read. These include the biggest scandals, events, and improvements surrounding Node.js in 2016.
Let's get started!
Programmers were shocked looking at broken builds and failed installations after Azer Koçulu unpublished more than 250 of his modules from NPM in March 2016 - breaking thousands of modules, including Node and Babel.
Koçulu deleted his code because one of his modules was called Kik - same as the instant messaging app - so the lawyers of Kik claimed brand infringement, and then NPM took the module away from him.
"This situation made me realize that NPM is someone’s private land where corporate is more powerful than the people, and I do open source because Power To The People." - Azer Koçulu
One of Azer's modules was left-pad, which padded out the lefthand-side of strings with zeroes or spaces. Unfortunately, 1000s of modules depended on it..
You can read the rest of this story in The Register's great article, with updates on the outcome of this event.
The reason? There were a couple of fundamental problems with npm for Facebooks’s workflow.
- At Facebook’s scale npm didn’t quite work well.
- npm slowed down the company’s continuous integration workflow.
- Checking all of the modules into a repository was also inefficient.
- npm is, by design, nondeterministic — yet Facebook’s engineers needed a consistent and reliable system for their DevOps workflow.
Instead of hacking around npm’s limitations, Facebook wrote Yarn from the scratch:
- Yarn does a better job at caching files locally.
- Yarn is also able to parallelize some of its operations, which speeds up the install process for new modules.
- Yarn uses lockfiles and a deterministic install algorithm to create consistent file structures across machines.
- For security reasons, Yarn does not allow developers who write packages to execute other code that’s needed as part of the install process.
Yarn, which promises to even give developers that don’t work at Facebook’s scale a major performance boost, still uses the npm registry and is essentially a drop-in replacement for the npm client.
You can read the full article with the details on TechCrunch.
New support for Node.js debuggability landed in Node.js master in May.
To use the new debugging tool, you have to
nvm install node
- Run Node with the
node --inspect index.js
- Open the provided URL you got, starting with “chrome-devtools://..”
Read the great tutorial from Paul Irish to get all the features and details right!
Jonathan Zarra, the creator of GoChat for Pokémon GO reached 1 million users in 5 days. Zarra had a hard time paying for the servers (around $4,000 / month) that were necessary to host 1M active users.
He never thought to get this many users. He built this app as an MVP, caring about scalability later. He built it to fail.
Zarra was already talking to VCs to grow and monetize his app. Since he built the app as an MVP, he thought he can care about scalability later.
He was wrong.
Thanks to it's poor design, GoChat was unable to scale to this much users, and went down. A lot of users lost with a lot of money spent.
500,000 users in 5 days on $100/month server
Erik Duindam, the CTO of Unboxd has been designing and building web platforms for hundreds of millions of active users throughout his whole life.
Frustrated by the poor design and sad fate of Zarra's GoChat, Erik decided to build his own solution, GoSnaps: The Instagram/Snapchat for Pokémon GO.
Erik was able to build a scalable MVP with Node.js in 24 hours, which could easily handle 500k unique users.
The whole setup ran on one medium Google Cloud server of $100/month, plus (cheap) Google Cloud Storage for the storage of images - and it was still able to perform exceptionally well.
How did he do it? Well, you can read the full story for the technical details:
#5: Getting Started with Node.js - The Node Hero Tutorial Series
The aim of the Node Hero tutorial series is to help novice developers to get started with Node.js and deliver software products with it!
You can find the full table of contents below:
- Getting started with Node.js
- Using NPM
- Understanding async programming
- Your first Node.js HTTP server
- Node.js database tutorial
- Node.js request module tutorial
- Node.js project structure tutorial
- Node.js authentication using Passport.js
- Node.js unit testing tutorial
- Debugging Node.js applications
- Node.js Security Tutorial
- Deploying Node.js application to a PaaS
- Monitoring Node.js Applications
This tutorial helps you to use RabbitMQ to coordinate work between work producers and work consumers.
Unlike Redis, RabbitMQ's sole purpose is to provide a reliable and scalable messaging solution with many features that are not present or hard to implement in Redis.
RabbitMQ is a server that runs locally, or in some node on the network. The clients can be work producers, work consumers or both, and they will talk to the server using a protocol named Advanced Messaging Queueing Protocol (AMQP).
You can read the full tutorial here.
James M Snell, IBM Technical Lead for Node.js attended his first TC-39 meeting in late September.
James and Bradley Farias (@bradleymeck) have been trying to figure out how to best implement support for ECMAScript Modules (ESM) in Node.js without causing more trouble and confusion than it would be worth.
Because of the complexity of the issues involved, sitting down face to face with the members of TC-39 was deemed to be the most productive path forward.
The full article discusses what they found and understood from this conversation.
We at Trace by RisingStack conducted a survey during 2016 Summer to find out how developers use Node.js.
The results show that MongoDB, RabbitMQ, AWS, Jenkins, Docker and Amazon Container Services are the go-to choices for developing, containerizing and shipping Node.js applications.
The results also tell Node developers major pain-point: debugging.
You can read the full article with the Node.js survey results and graphs here.
The Node Foundation announced at Node.js Interactive North America that it will oversee the Node.js Security Project which was founded by Adam Baldwin and previously managed by ^Lift.
As part of the Node.js Foundation, the Node.js Security Project will provide a unified process for discovering and disclosing security vulnerabilities found in the Node.js module ecosystem. Governance for the project will come from a working group within the foundation.
The Node.js Foundation will take over the following responsibilities from ^Lift:
- Maintaining an entry point for ecosystem vulnerability disclosure;
- Maintaining a private communication channel for vulnerabilities to be vetted;
- Vetting participants in the private security disclosure group;
- Facilitating ongoing research and testing of security data;
- Owning and publishing the base dataset of disclosures, and
- Defining a standard for the data, which tool vendors can build on top of, and security and vendors can add data and value to as well.
You can read the full article discussing every detail on The New Stack.
The Node.js Maturity Checklist gives you a starting point to understand how well Node.js is adopted in your company.
The checklist follows your adoption trough establishing company culture, teaching your employees, setting up your infrastructure, writing code and running the application.
You can find the full Node.js Maturity Checklist here.