Image for post
Image for post

In October 2019, I started studying computer science in a german university of applied science. The first semester went pretty well and so I was motivated for the second one. I remember exactly the day of my first exam: I saw a news report about the first Covid-19 case in my homeland, Germany. From here on, it didn’t take a long time until the virus has spread worldwide.

Because of the circumstances my university, and many others, decided to hold the next semester as a digital one. …

Image for post
Image for post

Zobrist hashing, named for its inventor Albert Zobrist, is a technique to represent game board positions, like from chess or Go, as hash value. It’s mainly used with transposition tables, a special kind of hash table that is indexed by a board position and used to avoid analyzing the same board position more than once.

What it’s good for

In game theory, there are algorithms like Minimax or AlphaBeta that are used to analyze board positions and find the best possible move in the given situation. This might be applied to games like chess, Go or tic-tac-toe.

These algorithms take a given starting position and simulate the further course of the game with all possible moves for each player. With the help of an evaluation method, that is prescribed by the developer, the algorithm can calculate a score in each game situation. Based on this score the algorithm knows how good or bad a position is or a move that has led to this position. Ideally, the outpout of such an algorithm is the best possible move with it’s calculated score. …

Image for post
Image for post

Docker is a term you might already have heard or read about in the tech scene since it’s a quite upcoming trend in the last couple of years. Docker is platform as a service (PaaS) mostly used by software developers to develop, deploy, and run applications. A big benefit of it is that you can ship and run your application (almost) anywhere without having any external software installed on your operating system that is needed for your app besides Docker.

So, what exactly is Docker? (Source)

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have. …

Image for post
Image for post

Some time ago I searched for an easy way to establish a communication channel between a mobile device and a Node.js webserver. My goal was to exchange messages over this channel and receive information about the weather, public transportation and more.

For example I send the message /train and receive a response with realtime details about train departure times of preconfigured routes. So the Node.js server receives the incoming message, processes it and sends a response back to the client.

After doing some researches I finally came up with Telegram bots since they are very easy to setup and fit perfect to my needs. …

Image for post
Image for post

A stack is a fundamental data structure in programming. It behaves like a data container where new items are added to the top of the stack and you only have access to last one added (most top item).

A definition by Oracle (source)

The Stack class represents a last-in-first-out (LIFO) stack of objects. …

Image for post
Image for post
by Katerina Limpitsouni

Some days ago I wrote a story about how I structure my Node.js REST APIs. However, I didn’t cover any test scenarios in there. So it’s time to catch up on this now.

We’re going to write an unit test for a single API component based on the project structure from my other story. The goal is to test the component by mocking a database and sending an HTTP request to its routes.

For writing tests I use the following node modules:

  • Mocha
  • Chai
  • Supertest

Project structure

This is the project structure I mentioned above. …

Image for post
Image for post

In this article, I will walk you through setting up path aliases in your TypeScript project and show you how to clean up your code.

The problem

In Node.js (or TS/JS in general) you can import modules into your code. This might look like the following:

import { User } from '../../user/model';
import { Article } from '../../article/model';
import { Cache } from '../../../../cache';
import { MongoDB } from '../../../../mongodb';

Notice these dots ../../ to access parent directories.

The problem we have here is that the deeper your project tree is, the more ../ are required to access modules in higher layers. This doesn’t look very clean to be honest, it’s difficult to understand, and it can make any code reorganization very painful. …

Image for post
Image for post

When I started using Node.js for building REST APIs on the server side, I struggled a lot with the same question over and over again:

How should the folder structure look like?

Obviously there’s not a perfect or 100% correct answer to this question but after reading some articles regarding this topic, I found a folder structure that fits my needs pretty well. So today I’d like to show you how I structure my REST APIs.

The APIs are mostly component based what makes it much easier to request only the data we really need. …


Lars Wächter

cs student | software developer

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