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.
stopto this directory:
You can easily do this by typing:
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.
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.
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
Setting up an OAuth integration for the first time can be a little confusing. Luckily, most OAuth integrations, including Google, follow the same flow:
In this article we will explore five ways to create a HTTP server with Deno, using the standard library and four packages.
You can find all the code here: https://github.com/tomanagle/deno-http-servers
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.
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.
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.
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:
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.
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.
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. …