Photo by Adam Borkowski on Unsplash

Welcome back to this series of building a microservice application using gRPC, Python, and Golang. This is the last part of our journey. If you followed this series from the beginning, you probably knew that this app is some kind of a mix between REST and gRPC. So this time, we can change that by creating the frontend side using Jinja2 template engine. Let’s start…

Creating Layout Template and Change the Root View

If you know React or Vue, probably you are already familiar with the concept of components or widgets, but not just in React and Vue we can separate HTML part into its own files, we…

Photo by Minkus on Unsplash

In this article, we will continue building our app and focus on the todo CRUD operations. Since the implementations are not quite different from the auth service, hopefully, this article would be shorter. Let’s jump into it!

Todo Service

Likewise the auth service, first we have to do some set up before moving on to write a proto file.

Create a database called grpc_todo and a table called todo. You can create this table using this query.

CREATE TABLE public.todos (id serial NOT NULL,title varchar(64) NOT NULL,description varchar(256) NULL,user_id int4 NULL,CONSTRAINT todos_pkey PRIMARY KEY (id));


Photo by OMID VISUALS on Unsplash

Welcome back to the second part of this tutorial. We will continue our journey of learning and building an app using gRPC, Python, and Golang. This time, we focus on the implementation details for the authentication service. Let’s start….

Auth Server

First, we have to create the authentication service and the language we use will be Golang. Then, we connect this service to the main service. Now, make sure that you are in the root folder. By the way, if you prefer to separate the services of this project into its own repository, that’s okay. …

Photo by Henry Chen on Unsplash

In this series of articles, we will learn about the concept of gRPC and its implementation in Python and Golang. Then to make sure we understand what we’ve learned, we will build a simple todo application with minimum functionalities yet still challenging enough for us to implement it.

The whole application structure will be composed of three different smaller services. One service will be responsible for authentication, another will be responsible for managing todos and the last one serves as the main interface which directly connected to the user. The architecture will resemble microservice with some minimalistic and custom design.

Photo by James Wainscoat on Unsplash

Is it fascinating to see how simple rules can lead to something so complex? For example, like the flock of birds or school of fish. The rule for them is pretty simple, they will survive if they are able to avoid predators. One of the explanations of how birds work as a flock was stated by a Zoologist Wayne Potts in journal Nature in 1984. His work showed that birds in flocks don’t just follow a leader or their neighbours. Instead, they anticipate sudden changes in the flock’s direction of motion. …

Photo by Emma Svalstad on Unsplash

In this article, we will continue our journey about Python Decorator and talk about a bit more complex concepts. From the previous article, we asked could a decorator takes arguments? We will learn it here.

Decorating methods

In the previous article, we learned about how to decorate a function, but can we also decorate a method. Basically, a method of a class is a function, the difference is a method is called by a name that is associated with an object.

Let’s start with some built-in decorators.

On the above code, we defined a class named Vector. This class represents a…

Photo by Timo Vijn on Unsplash

On this article, we will talk about one of many features in Python which heavily used, which is Decorator. Decorator gives us a simple form when we want to decorate our function with higher-order function. Generally, we will use decorator when we have several functions with different purposes, but they are not entirely different. So, we should put their similarity in one place and decorate others to let them do their specific task. We have to do this to make our codes DRY.

By definition, a decorator is a function which takes other function as an argument and returns that…

Photo by virginia lackinger on Unsplash

Artikel ini adalah lanjutan dari bagian pertama yang sudah di-post sebelumnya. Kita akan melanjutkan apa yang sudah dibahas dan masuk ke bagian dimana Python Decorator menjadi sedikit lebih kompleks. Pada artikel sebelumnya ada satu pertanyaan mengenai apakah Decorator dapat menerima argumen? Kita akan mempelajarinya pada artikel ini.

Mendekorasi Method

Pada artikel sebelumnya kita sudah mempelajari cara mendekorasi fungsi, tapi apakah kita bisa mendekorasi sebuah metode dari class. Pada dasarnya metode dari sebuah class adalah fungsi, perbedaannya fungsi ini dibawa menjadi properti sebuah object atau instance dari class tersebut. Mari kita berkenalan terlebih dahulu dengan built-in decorators yang umum digunakan.

Beberapa decorator itu…

Photo by corina ardeleanu on Unsplash

Pada artikel kali ini kita akan membahas salah satu “fitur” yang banyak digunakan di bahasa pemrograman Python, yaitu Decorator. Pada aplikasinya decorator memberi kita bentuk yang lebih sederhana saat kita bergelut dengan kode yang ingin di-”dekorasi” oleh sebuah higher-order function. Umumnya kita akan menggunakan decorator jika ada beberapa fungsi yang memiliki tugas berbeda, tetapi terdapat kemiripan. Sehingga kita bisa menempatkan “sifat” kemiripan ini pada satu fungsi dan fungsi inilah yang akan mendekorasi fungsi-fungsi lain. Akhirnya membuat kode kita mengikuti kaidah DRY seperti yang seharusnya.

Secara definisi Decorator adalah sebuah fungsi yang menerima fungsi lain sebagai argumen dan mengeluarkan fungsi tersebut…

Agus Richard

I am a Software Engineer and Data Science Enthusiast. Love to learn and write. LinkedIn:

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