hello.js

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

Monday, 20 May, 2019 UTC

Node.js TypeScript #14. Measuring processes & worker threads with Performance Hooks

Node.js TypeScript #14. Measuring processes & worker threads with Performance Hooks

When writing Node.js code, we can approach tasks in many ways. While all of them might work fine, some perform better than others, and as developers, we should strive to make both easily readable and fast applications. In this article, we learn how to ... more


Monday, 13 May, 2019 UTC

Node.js TypeScript #13. Sending data between Worker Threads

Node.js TypeScript #13. Sending data between Worker Threads

The Worker Threads give us quite exciting features when compared to, for example, child processes. In this article, we create our instances of the MessageChannel to communicate with the Worker Threads. Aside from that, we also share the data between ... more


Monday, 6 May, 2019 UTC

Node.js TypeScript #12. Introduction to Worker Threads with TypeScript

Node.js TypeScript #12. Introduction to Worker Threads with TypeScript

The Node.js and JavaScript are often perceived as a single-threaded but in this series, we prove that it is not entirely true. Node.js creates threads when performing Input/Output operations. Not only that, but we can also create additional processes. ... more


Monday, 29 April, 2019 UTC

Node.js TypeScript #11. Harnessing the power of many processes using a cluster

Node.js TypeScript #11. Harnessing the power of many processes using a cluster

After finding out that Node.js is in its nature single-threaded, we might think that all the cores of your processor are meant to go to waste, but this is not necessarily the case. In the previous part of this series, we prove that Node.js creates additional ... more


Monday, 22 April, 2019 UTC

Node.js TypeScript #10. Is Node.js single-threaded? Creating child processes

Node.js TypeScript #10. Is Node.js single-threaded? Creating child processes

The Node.js environment and JavaScript is often identified with running just one task at a time, but this is not precisely the case. In this article, we go through the concept of multiple processes and spawn them using the child process module. Along ... more


Tuesday, 16 April, 2019 UTC

Creating malicious packages and dealing with them using npm audit

Creating malicious packages and dealing with them using npm audit

The world is a tough place – a lot of people out there to get you! While I might not teach you some martial arts and self-defense here, I hope to raise your level of awareness where it comes to malicious code. NPM happens to serve it every now and then! ... more


Monday, 8 April, 2019 UTC

Node.js TypeScript #9. The Event Loop in Node.js

Node.js TypeScript #9. The Event Loop in Node.js

JavaScript and the Node.js environment uses the Event Loop. In this article, we explore the idea of it and go through different phases that the event loop has. Although this series aims to present the usage of Node.js with TypeScript, this time we don’t ... more


Tuesday, 2 April, 2019 UTC

Node.js TypeScript #8. Implementing HTTPS with our own OpenSSL certificate

Node.js TypeScript #8. Implementing HTTPS with our own OpenSSL certificate

HTTPS seems to be everywhere now – it is a great time to go through its principals. Int his article we generate our certificate and use the HTTPS module from Node.js. With it, we can implement HTTPS in our local development environment. What problems ... more


Tuesday, 26 March, 2019 UTC

Node.js TypeScript #7. Creating a server and receiving requests

Node.js TypeScript #7. Creating a server and receiving requests

In this article, we continue the Node.js series. This time we listen for requests and send responses . To do that, we again use the HTPP module from Node.js. Node.js TypeScript: Creating a server, receiving requests In the TypeScript Express tutorial, ... more


Monday, 18 March, 2019 UTC

Node.js TypeScript #6. Sending HTTP requests, understanding multipart/form-data

Node.js TypeScript #6. Sending HTTP requests, understanding multipart/form-data

The HTTP is a protocol allowing you to fetch resources such as JSON data and HTML documents. Two sides of the connection, the client and the server, communicate by exchanging messages. The message sent by the client is a request . The message sent by ... more


Monday, 11 March, 2019 UTC

Node.js TypeScript #5. Writable streams, pipes, and the process streams

Node.js TypeScript #5. Writable streams, pipes, and the process streams

In this article, we continue covering streams , since they have a significant role in Node.js development. This time we focus on writable streams and pipes. To illustrate how a writable stream works we implement our simple version of a stream writing ... more


Tuesday, 5 March, 2019 UTC

Node.js TypeScript #4. Paused and flowing modes of a readable stream

Node.js TypeScript #4. Paused and flowing modes of a readable stream

Streams are present in programming for a long time now and it looks like they are going to stay. In Node.js they also play a big role and with them, we can deal with reading/writing data in an efficient way. You can encounter streams, for example, when ... more


Tuesday, 26 February, 2019 UTC

Node.js TypeScript #3. Explaining the Buffer

Node.js TypeScript #3. Explaining the Buffer

Today we dive into another essential concept connected to Node.js: buffers . To understand them, we also explain what binary data is and why do we need character encodings . All this information is crucial when diving into other parts of Node.js , such ... more


Tuesday, 19 February, 2019 UTC

Node.js TypeScript #2. The synchronous nature of the EventEmitter

Node.js TypeScript #2. The synchronous nature of the EventEmitter

In this article, we continue going through the main concepts connected to Node.js . This time we dive into the idea of the Node.js EventEmitter . We explain its synchronous nature and how it works, which helps with understanding other Node.js features ... more


Wednesday, 13 February, 2019 UTC

Node.js TypeScript #1. Modules, process arguments, basics of the File System

Node.js TypeScript #1. Modules, process arguments, basics of the File System

In this series, we go through the core concepts of Node.js. In general, in this series, we focus on the environment of Node.js and not the JavaScript itself, while having the advantages of static typing using TypeScript. It includes matters like the ... more


Monday, 4 February, 2019 UTC

TypeScript Express tutorial #10. Testing Express applications

TypeScript Express tutorial #10. Testing Express applications

An essential part of developing a fully functional software is testing . In this article, we focus on making our application more testable and implementing unit and integration tests using Jest and a library called SuperTest. This part of the TypeScript ... more


Monday, 28 January, 2019 UTC

TypeScript Express tutorial #9. The basics of migrations using TypeORM and Postgres

TypeScript Express tutorial #9. The basics of migrations using TypeORM and Postgres

In this article, we go through migrations, which is a significant thing when working with Postgres . We learn what they are and the basics of how to write them. Although the knowledge of SQL is useful here, we also learn how to have them auto-generated ... more


Monday, 21 January, 2019 UTC

TypeScript Express tutorial #8. Types of relationships with Postgres and TypeORM

TypeScript Express tutorial #8. Types of relationships with Postgres and TypeORM

Today we continue using Postgres with Express and Typescript. Since Postgres is a relational database, relationships are an essential part of working with it, and we cover it today. To handle it we use TypeORM. The code for the tutorial is in the express-typescript ... more


Tuesday, 15 January, 2019 UTC

TypeScript Express tutorial #7. Relational databases with Postgres and TypeORM

TypeScript Express tutorial #7. Relational databases with Postgres and TypeORM

Today our tutorial takes a bit of a turn as we look into relational databases, Postgres in particular. In this article, we go through setting up an environment with Express Postgres . We also set up the pgAdmin platform so that we get an overview of ... more


Monday, 7 January, 2019 UTC

TypeScript Express tutorial #6. Basic data processing with MongoDB aggregation

TypeScript Express tutorial #6. Basic data processing with MongoDB aggregation

With MongoDB aggregation, we can process data and get computed results. Thanks to that, we get additional information about the documents in our collections. You can use it to perform some tasks on the data and let the MongoDB handle it for you. In this ... more


Monday, 31 December, 2018 UTC

TypeScript Express tutorial #5. MongoDB relationships between documents

TypeScript Express tutorial #5. MongoDB relationships between documents

Today we dive into MongoDB relationships between documents. To do it we use Mongoose and the populate feature. As always, the code that we cover here is available in the express-typescript repository. You’re welcome to give it a star. MongoDB relationships ... more


Monday, 24 December, 2018 UTC

TypeScript Express tutorial #4. Registering users and authenticating with JWT

TypeScript Express tutorial #4. Registering users and authenticating with JWT

Today we cover an essential part of almost every application: registering users and authenticating them. To implement it, we use JSON Web Tokens (JWT). Instead of getting help from libraries like Passport, we build everything from the ground up to get ... more


Tuesday, 18 December, 2018 UTC

TypeScript Express tutorial #3. Error handling and validating incoming data

TypeScript Express tutorial #3. Error handling and validating incoming data

Since not always everything goes perfectly, you need to expect the unexpected. To prepare for that, we cover TypeScript Express error handling and incoming data validation. Just as before, the repository for the tutorial is mwanago/express-typescript. ... more


Tuesday, 11 December, 2018 UTC

TypeScript Express tutorial #2. MongoDB, models and environment variables

TypeScript Express tutorial #2. MongoDB, models and environment variables

In this part of the Express TypeScript tutorial, we cover using a MongoDB database. To do that properly, we also learn the concept of environment variables . Since we follow the MVC pattern, we introduce the idea of a model . Just as in the previous ... more


Tuesday, 4 December, 2018 UTC

TypeScript Express tutorial #1. Middleware, routing, and controllers

TypeScript Express tutorial #1. Middleware, routing, and controllers

Hello! In this new series, we build a RESTful application with TypeScript Express . The course is going to cover the fundamental concepts of the express framework and tools like MongoDB . Some basic knowledge of TypeScript would be useful, as we focus ... more


Monday, 26 November, 2018 UTC

Using recursion to traverse data structures. Execution context and the call stack

Using recursion to traverse data structures. Execution context and the call stack

Hello! Today we tackle a very interesting topic, which is recursion. The article describes its main principles and dives deeper to uncover how does it work under the hood of the language, covering execution context and the call stack. Let’s go! JavaScript ... more


Monday, 19 November, 2018 UTC

Is eval evil? Just In Time (JIT) compiling

Is eval evil? Just In Time (JIT) compiling

There is a high chance that you’ve stumbled across the JavaScript eval function. It is a common knowledge that in JavaScript, eval is something that is a bad practice. Have you ever wondered how it works and why exactly a lot of people discourage it? ... more


Wednesday, 14 November, 2018 UTC

Handling errors in JavaScript with try…catch and finally

Handling errors in JavaScript with try…catch and finally

Mistakes happen. That’s a given. According to Murphy’s law, whatever can go wrong, will go wrong. Your job, as a programmer, is to be prepared for that fact. You have a set of tools that are prepared to do precisely that. In this article, we go through ... more


Monday, 5 November, 2018 UTC

Cross-Origin Resource Sharing. Avoiding Access-Control-Allow-Origin CORS error

Cross-Origin Resource Sharing. Avoiding Access-Control-Allow-Origin CORS error

In this article, we explain what Cross-Origin Resource Sharing ( CORS ) is and how to avoid errors associated with it and the Access-Control-Allow-Origin header. This includes describing it both from the viewpoint of the frontend and the backend. CORS: ... more


Monday, 29 October, 2018 UTC

Comparing working with JSON using the XHR and the Fetch API

Comparing working with JSON using the XHR and the Fetch API

Nowadays, JavaScript is often used to make Ajax requests. There are a lot of libraries that can do that for us, for example, axios or jQuery . Both of them use XMLHttpRequest ( XHR ). It differs from the relatively new Fetch API that was introduced a ... more