Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialALBERT QERIMI
49,872 PointsWhat'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
15,604 PointsAlbert,
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