2coffee.dev

  • Resource Limitations for Services Using PM2
    • 🏷️pm2
    • 🏷️javascript
    • 🏷️node.js

    Resource Limitations for Services Using PM2

    Hello readers of 2coffee.dev, it's been a while since we last met. A week or two ago, I encountered quite an interesting problem while deploying a system. I initially thought of not writing it down, but then I realized that someone might face the same situation, so I diligently wrote it out. It's also a record to remember and share with everyone. The system I am in charge of has a rather old service that was deployed based on pm2 using...

    🕝1 month ago

  • Compilation of Libraries Supporting CLI Application Development for Node.js
    • 🏷️node.js
    • 🏷️javascript

    Compilation of Libraries Supporting CLI Application Development for Node.js

    Hello readers of 2coffee.dev. I wonder if anyone here has been using command-line applications (CLI)? If so, why did you choose it over a graphical user interface (GUI)? If I remember correctly, I have written a few articles about the process of creating some applications for myself. Honestly, for me, there are many cases where CLI proves to be much more useful...

    🕝5 months ago

  • 5 things I like about Deno
    • 🏷️deno
    • 🏷️javascript
    • 🏷️node.js

    5 things I like about Deno

    The stable version of Deno was introduced about 3-4 years ago. At that time, it received quite a bit of attention because none other than Ryan Dahl, the creator of Node.js, was also the patron of Deno. Huh! You heard that right. Why would he create a new tool to compete with his own "child"? Ryan Dahl admitted that Node.js has critical weaknesses. Initially, Node.js was designed to focus on simplicity and flexibility. But over the years, everything has...

    🕝6 months ago

  • Maybe Data Type
    • 🏷️javascript
    • 🏷️node.js

    Maybe Data Type

    Promises in JavaScript are certainly familiar to anyone. A Promise represents a "promise" that when a function is called, it will definitely return a value in the future. Whether it is resolved or rejected, we can predict the likelihood of one of the two occurring. And one thing is for sure, both cannot occur at the same time. If you study Promise more closely, you will see...

    🕝6 months ago

  • Series
    process.nextTick, setImmediate, and setTimeout
    • 🏷️javascript
    • 🏷️node.js

    process.nextTick, setImmediate, and setTimeout

    In the previous article, we learned about the 6 phases of an event loop, their functions, and which types of callback functions are handled in each phase. Additionally, there is a special phase called process.nextTick, which is not part of the Event loop but has the highest priority. This seemingly simple concept often confuses many, even experienced developers. So, when process.nextTick, setImmediate, and setTimeout are placed together, which callback do you think executes first...

    🕝8 months ago

  • A Few Useful Functions in Node.js Util Module
    • 🏷️node.js
    • 🏷️javascript

    A Few Useful Functions in Node.js Util Module

    Node.js encompasses a range of components that come together to form a JavaScript runtime environment. In our series on Node.js Architecture - Introduction to Node.js, we explored the various components that make up Node.js and their respective functions. One of the built-in modules in Node.js is `util`, which, in my opinion, deserves more attention. The `util` module comprises a collection of small utility functions that can be helpful in certain situations. In this article, we will delve into some of these functions...

    🕝9 months ago

  • The Concept of Immutability in JavaScript
    • 🏷️javascript
    • 🏷️node.js

    The Concept of Immutability in JavaScript

    Variables are an essential component in most programming languages. When we talk about variables, we often think of a syntax that includes a keyword, variable name, data type, and its initial value. Variables - as the name suggests, their values can be changed through assignment. Changing the value of a variable allows programmers to reuse variable names, save memory, and...

    🕝1 year ago

  • Promise: How to Use and Some Notes!
    • 🏷️promise
    • 🏷️javascript
    • 🏷️node.js

    Promise: How to Use and Some Notes!

    It would be a glaring omission not to talk about Promise in JavaScript. In fact, there have been many articles written about Promise, which you can find through Google or occasionally come across in a programming-related community. But because Promise is an important concept and everyone has a different way of explaining it, I still decided to write this article. When I first learned JavaScript, Promise was the most confusing thing. I thought I understood it and knew how to use it, but in reality, there were still many long and painful stumbles...

    🕝1 year ago

  • Point-Free Style in JavaScript
    • 🏷️javascript
    • 🏷️node.js

    Point-Free Style in JavaScript

    My initial encounter with this style left me quite puzzled. What are toJSON, handleResult, and handleError here? Are they functions, and if so, where are their parameters? How can they run without ending with () to call the function? Or at the very least, where are their input parameters? Numerous questions popped up in my mind, but at that time, there was no one to explain it to me. What you encounter frequently becomes familiar, so I started emulating this style, implicitly thinking, "Oh, I'll just write it like this, and it will work." It wasn't until later...

    🕝1 year ago

  • Some Ways to Write More Readable Code in JavaScript/Node.js
    • 🏷️javascript
    • 🏷️node.js

    Some Ways to Write More Readable Code in JavaScript/Node.js

    What I believe many programmers aspire to is writing code that is easy to read and understand. There is plenty of evidence, such as the numerous Design Patterns that have been introduced to guide people in solving problems the way many still do. However, that's not all there is to it. Writing comprehensive code depends on each individual programmer. We have various tools to aid in source code editing in many ways, such as formatting, colors, display interfaces, debugging support, allowing us to choose according to our preferences or collaborate with teams. In addition, there are still rules in place for team members to adhere to.

    🕝1 year ago