Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

ALBERT QERIMI
ALBERT QERIMI
49,872 Points

What's happening with NodeJS right now?

I read articles that people are abandoning their node projects after Ryan Dahl is working on AI now? “Node.js is one of the worst things to happen to the software industry ... reading articles like this?

1 Answer

Charles Kenney
Charles Kenney
15,604 Points

Albert,

This is an old quote from a HackerNews thread in 2012 in response to an article about how bad NodeJS was. NodeJS was still in its infancy then and people were frustrated with Node's lack of application, javascript's weird API, and how difficult it was to write readable asynchronous code.

NodeJS/Javascript in general has come a long way since then and has gained a huge community with thousands of libraries/frameworks and now yearly updates to push core language features. The npm registry has ~542,000 packages at the moment. NodeJS as a runtime environment has gotten faster and has been given more application thanks to awesome community driven projects like electron, react-native, etc. We now have an API for writing clean asynchronous code, libraries for automatic error handling, polyfills for bridging gaps with compatibility, etc. NodeJS is great!

Heres an example of how asynchronous programming has evolved with the new versions of ecmascript.

Old Javascript

var models = require('../models');

function getUser(req, res, next) {
  // get user id
  var uid = req.param.uid;
  // find user by id
  models.User.findById(uid, function(err, user) {
    if (err) next(err);
    else res.send(user);
  });
}

New Javascript

import { User } from '../models';

const getUser = async (req, res, next) => {
  // get user id
  const { uid } = req.param;
  // find user by id
  const user = await User.findById(uid);
  res.send(user);
};

Much simpler and easier to read, right!? Generally now, I think Javascript gets the respect it deserves. I mean take a look at how many jobs there are out there for Node developers on indeed; there's a lot of opportunity.

Hope this answers your question, Charles