3 Easy Steps for a (Dev)Containerized Microservice With Jolie and Docker

In this brief tutorial, let's look at how we can quickly kickstart the codebase of a microservice that can be developed and run in containers. We achieve this by using the Jolie programming language, npm, VS Code, and Docker

Prerequisites 

You will need npm, Docker, and VS Code installed. Make sure that you have enabled support for Dev Containers in VS Code. (Jolie comes preloaded in the Docker images that we are going to use, so no need to install it.)

Comparing Express With Jolie: Creating a REST Service

Jolie is a service-oriented programming language, developed with the aim of making some key principles of service-oriented programming syntactically manifest. Express is a leading framework in the world of JavaScript for the creation of REST services.

The concepts behind Express/JavaScript and Jolie are not that distant, but they are offered under different shapes: one aimed at building on top of JavaScript and Node.js, the other aimed at expressing these concepts declaratively. The aim of this article is to identify the first differences that arise between Express and Jolie in the development of a REST service by comparing how the same concepts are codified.

Decorating Microservices

The Decorator pattern is used to modify the behavior of a target component without changing its definition. This idea turns out to be pretty useful in the context of microservices because it can give you a better separation of concerns. It might even be necessary because the target service might be outside your control. This text looks at how a decorator can be implemented as a service, particularly one that sits between clients and a target service. We look at how a decorator can be implemented as a service, in particular one that sits between clients and a target service.

Example: an E-mail Service

Let's introduce an example as a reference for our discussion.