hello.js

var please = require('share');
console.log('thank you');

Thursday, 11 October, 2018 UTC

How to find the best open source Node.js projects to study for leveling up your skills

How to find the best open source Node.js projects to study for leveling up your skills

To senior developer: “How did you get so good at programming?” “I don’t know, I guess I just wrote a lot of code, and read a lot of it too…” Have you ever tried finding an open source Node.js project that you could study to level up your skills, only ... more


Wednesday, 26 September, 2018 UTC

Separating logic from Express routes for easier testing

Separating logic from Express routes for easier testing

Have you ever been confused on how to structure your Express applications in a way that makes them testable? As with most things in the Node.js world, there are many ways of writing and structuring Express apps. The best place to start though is usually ... more


Thursday, 6 September, 2018 UTC

Why isn’t this unit test catching an error from this async/await function?

Why isn’t this unit test catching an error from this async/await function?

When you’re writing unit tests for asynchronous functions in JavaScript, one test case you’ll usually want to have is making sure the async function throws an error in case of an error scenario. Let’s imagine writing a test for an item function that ... more


Tuesday, 28 August, 2018 UTC

Know what to test using these recipes: Node service that calls a database

Know what to test using these recipes: Node service that calls a database

If you’ve ever gone through a JavaScript or Node unit testing tutorial, it can be difficult to find anything that shows you what you should be testing – what scenarios to cover, what to write tests for, etc. It’s easy to find tutorials that take you ... more


Tuesday, 31 July, 2018 UTC

Tried TDD and didn’t realize the benefits? Try it the next time you get writer’s block

Tried TDD and didn’t realize the benefits? Try it the next time you get writer’s block

Have you ever tried Test-Driven Development (TDD) thinking it would be the “holy grail” it’s often made out to be, only to end up feeling like it was pointless? Maybe it didn’t add any benefit to your code. Maybe writing your test first, then the code ... more


Wednesday, 11 July, 2018 UTC

Using the `debug` module to avoid polluting your application logs with logs from Node modules

Using the `debug` module to avoid polluting your application logs with logs from Node modules

Have you ever added logging to your custom Node modules, thinking you’ll benefit from all that extra information, only to find that when you add the modules as dependencies, run npm install and npm start , your application logs start looking like the ... more


Tuesday, 3 July, 2018 UTC

Why should your Node.js application not handle log routing?

Why should your Node.js application not handle log routing?

It is not the responsibility of the application to route logs. 12 Factor says that logs should go to STDOUT. WAT? WHY? I just configured my whole application code to write logs to custom log files. What’s wrong with that? Logging is one of those things ... more


Wednesday, 20 June, 2018 UTC

Should you use a logging framework or console.log() in Node?

Should you use a logging framework or console.log() in Node?

The console module is usually the first tool Node.js developers reach for when handling logging in an application. It’s easy to use, native to the platform, and easy to read. But then you might stumble upon a logging framework like Winston or Bunyan. ... more


Sunday, 10 June, 2018 UTC

Explain JavaScript unit testing like I’m five

Explain JavaScript unit testing like I’m five

Unit testing is so critical to good software development, yet for beginners (and many experienced professionals as well) it’s something that can feel alien and uncomfortable at first. It might be something you know you should be doing, but haven’t had ... more


Wednesday, 23 May, 2018 UTC

Which of the 635000 npm modules do I choose?

Which of the 635000 npm modules do I choose?

If you’ve spent any time in the Node or Front End JavaScript world, you know there are hundreds of thousands of modules to choose from. Developers constantly ask things and express pain like: “What’s eating away at us is which modules to choose…” “What ... more


Monday, 7 May, 2018 UTC

../../../../ escaping relative path require hell in Node.js

../../../../ escaping relative path require hell in Node.js

../../../../../Having/to/write/code/like/this when you’re requiring local modules is a sight for sore eyes. Some consider it one of the bigger pain points with Node due to poor readability when trying to figure out where that module is in the directory ... more


Sunday, 15 April, 2018 UTC

Do you need to queue jobs in Node.js?

Do you need to queue jobs in Node.js?

If you’re coming to Node.js from a more synchronous language/environment such as Ruby on Rails or Java, the concept of asynchronous processing can be confusing. All the literature talks about Node being async, so it’s easy to get the understanding that ... more


Sunday, 25 March, 2018 UTC

Why does async/await in a .forEach not actually await?

Why does async/await in a .forEach not actually await?

If you’re trying to loop over a list while using async/await in Node.js (or the browser, for that matter), reaching for the .forEach array function might seem like a natural choice. Let’s say you go that route, fire up your tests or your application, ... more