Almost every NodeJS developer would be familiar with the error message Error listen EADDRINUSE: address already in use. The message simply means that the application could not start because there is already a process using that port. Here is the easiest way I have found to stop a process running on your Mac that is using a specific port.

Image for post
Image for post
  1. Add a new file called stop to this directory: usr/local/bin

You can easily do this by typing: usr/local/bin/stop

2. Past the following script into the file:

3. Save the script and start using it

You can use the script by typing stop 3000 in to your terminal from any directory, where 3000 is the port number that has a process on it that you want to kill. …

In a previous post, we explored how to integrate TypeScript with your Mongoose models. In this post, we’ll move up to the service layer and see how we can use Mongoose types to get even more out of your application's Mongoose & Typescript implementations.

Image for post
Image for post

Firstly let’s answer some basic questions about the service layer: what is a service layer and how do I use it?

The service layer is used to encapsulate implementations of an application’s business logic and provide an API for invocation of that logic in a consistent way.

Services are functions that perform common tasks on your data, such as reading, writing, updating, and deleting. Services are often called by controllers or resolvers, and a single service is often used by several different functions. …

Have you got several projects on the go that you’ll probably never finish? Yeah, me too. In this post, I will go through what I did to successfully develop and launch my latest side project. As a result of reading, I hope to inspire you to finish developing and launch one of your side projects.

Image for post
Image for post

Since I started working from home and haven’t been able to leave the house for anything non-essential, I have gained a lot of time and a nice home office setup.

Around the start of April, I made a conscious decision to spend my time creating things that would benefit my future, such as writing articles on Medium and a side project. …

In this post, you will learn how OAuth integrations work and specifically how you can set up a Google OAuth integration with your own Node.js application.

Note: This guide does not use Passport

Image for post
Image for post

How does OAuth work?

Setting up an OAuth integration for the first time can be a little confusing. Luckily, most OAuth integrations, including Google, follow the same flow:

  1. Provide the user with a link to the authentication system that includes what data you’d like the user to give your application access to (scopes), your client ID and a redirect URL
  2. When the user clicks the link and grants access to your application, they will be redirected back to your application with a security code in the query…

Deno’s growth has started to accelerate at an unprecedented rate. Partly because the creator is Ryan Dhal and partly because the JavaScript runtime looks extremely promising. Already, we have several different ways to create an HTTP server, the base for almost every modern application.

In this article we will explore five ways to create a HTTP server with Deno, using the standard library and four packages.

Image for post
Image for post

You can find all the code here:

Note: None of these solutions is a great choice for a brand new application. Deno is not ready for you to risk your job with, so it’s best to wait a while before you start suggesting Deno for your company’s next big project. …

In 2018, Ryan Dahl, the creator of Node.js, presented at JSConf on 10 things he regrets about Node.js. In the presentation, Dahl confessed that he couldn’t change Node.js now - It runs on millions of machines worldwide and is loved by millions of developers. So what do you do when you can’t change the old version? You move some of the letters around and create a brand new language.

In May 2020, Ryan Dahl, Bert Belder, and Bartek Iwańczuk announced Deno 1.0.

Image for post
Image for post

What’s the same as Node.js?

In the 2019 Stackoverflow developer survey, 50.4% of professional developers said they use Node.js. There’s a good reason why so many developers are using Node.js, there is a tone to love about it. While Deno does come with a whole host of new features, it also inherits the good parts of Node.js, …

Imagine coming across the same problem multiple times and having to re-develop a solution for it every time. That would be exhausting, it may even be confusing for those around you and your solution would never get the chance to be optimised. Instead, we use patterns to solve problems. In everyday life we call these heuristics, in software development we call them design patterns.

The design patterns in this post have examples in this repository:

Please submit pull requests if you would like to add a pattern or make a change to an existing pattern.

In software development, a design pattern is a solution to a commonly occurring problem that is generally agreed on as the best solution. Understanding design patterns…

Companies around the world are reducing their payroll or pivoting, increasing the pressure of development teams to produce features. As developers, we don’t just want to produce features like a canned soup factory, we want to produce products that we’re proud of and our customers love.

Image for post
Image for post

Code quality is important, for your developers, your quality assurance (QA) team, and most importantly, your customers. Maintaining a high level of code quality means:

  • Developers can maintain velocity as the codebase grows.
  • QA team keeps a steady stream of features flowing from development into production.
  • Most importantly, it means your customers have a better experience, increasing engagement and if you’ve all done your job right, profit. …

The architectural shift from monoliths to microservices came with a wide range of benefits. A reduction in complexity means the services are easier to design and build, the isolation of tasks means services can be team-specific, reducing the onboarding time for new developers and a reduction in processing power required to run the services makes it easier to scale horizontally.

Image for post
Image for post

But microservices come with one specific downside, you force front-end application developers to adopt the complexity that comes with consuming data from multiple sources, formatting the data and then, they can finally do their job and display the data. This goes against a fundamental rule for developing great APIs: absorb the complexity. …

Testing your software is one of the most important steps, unfortunately, it’s also one of the hardest. Whenever you introduce new technologies into your project, you have to consider how you’ll test them. You also need to make sure that those tests are robust, flexible and result in exceptional user experiences for your customers.

Testing GraphQL React Components
Testing GraphQL React Components

As a result of reading this guide, you will know how to test @apollo/react-hooks using Jest and React Testing Library.

Doesn’t Apollo’s documentation already teach you how to Test React Components using @apollo/react-hooks? The testing approach in the Apollo documentation may lead to incomplete test cases. The MockProvider requires you to mock both the function input and result. The result should come from the GraphQL server, so that’s fine to mock. …


Tom Nagle

I am a full stack JavaScript developer, living in Melbourne, Australia. My preferred stack is Mongoose, TypeScript, Node.js, React & GraphQL.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store