Welcome to my coding blog!

  • Configure Remix JS with MySQL

    It looks like Remix team not only likes music, but also has a great sense of humor. Production ready SQLite database. Well, I don’t know about that. Let’s go ahead and swap SQLite database for MySQL in Remix JS project. And If you don’t know what I’m talking about, let me quickly explain. Remix is…

  • Database Indexes With Sequelize

    In this article we will look at how to create database indexes with Sequelize. In posts Sorting REST API Results and Advanced Filtering in REST API we used allowedSortBy and allowFilterBy fields to make sure users don’t tank the database. However, if you have a lot of rows in your table, and we are talking…

  • Observer Pattern in JavaScript

    In this article we will explore the Observer Pattern in JavaScript. We will look at a real world example that involves processing order shipment and how to implement observer pattern in that context. In object oriented programming the Observer Pattern defines a one-to-many dependency between objects, where one object (the subject or observable) maintains a…

  • Strategy Pattern in JavaScript

    In this article we will describe the Strategy Pattern. We will define a real world scenario and explain how to solve it using the Strategy Design Pattern approach. According to Wikipedia: in computer programming, the strategy pattern (also known as the policy pattern) is a behavioral software design pattern that enables selecting an algorithm at runtime. Instead of implementing a single algorithm directly, code…

  • Correctly Handle JavaScript Error Messages

    In the post about REST API Filtering we have getFilterBy method in BaseRepository that calls getSequelizeWhereClause function and returns result. The call is wrapped up in try…catch block, so when an error is thrown, it gets transformed into an API error and get re-thrown. The message from the original error is assigned to the API…

  • Advanced Filtering in REST API

    In this article we will look at how to implement advanced filtering in REST API when a GET request a list of results. In our API project that will be GET /v1/travels and GET /v1/tours endpoints. Although setup for filtering is similar to sorting, the implementation is a bit more complex. First we are going…

  • Sorting REST API Results

    In this article we will look at how to sort results when using a GET request that returns a list. Implementing sorting functionality in a RESTful API is a crucial aspect of designing a robust and user-friendly web service. Sorting REST API results empowers developers and end-users alike by providing a systematic and organized way…

  • Sequelize Seeders: Generating Test Data

    In this article we will look at how to use Sequelize seeders to seed the database with test data and use Faker library to generate the test data. We will continue working in the project travel-api-db-migration-service we created in the video Sequelize Migrations. Please, watch that video if you would like to see how the…

  • REST API Delete Resource

    In this article we will look at REST API Delete operation. Compared to Create and Update, Delete operation is fairly easy and straightforward. REST API Delete Implementation Below, we will outline the basic steps of Delete operation implementation. Please, watch our video for more in depth explanation of this concept. Route and Controller In routes/v1/travels…

  • REST API Update Resource

    In the previous article REST API Request Validation we looked at how to create a resource using POST request and Joi validation. In this article we will look at how to use REST API Update operation to modify a resource. We will also be using Joi validation to ensure security and consistency. Compared to creation,…