Github stars and forks on matrix display

18 Sep 2021 \
2 minutes \
written by Philipp Blum
Categories: Tutorial

An easy to use application which displays the number of forks and stars of your Github repository on a matrix display.

Prerequisites #

Web of Things is all about interoperability. In another tutorial we flashed an app on an ESP32 with connected matrix LED diplay. This app exposes a Web of Things Thing Description and HTTP REST API. In this tutorial we are going to use this device in order to display the number of stars and forks on it. We are going to use the node-wot library which implements the Web of Things Scripting API. This reduces the amount of code we have to write in order to understand the REST API.

Clone the app #

git clone https://github.com/Citrullin/node-wot-github.git
cd node-wot-github

Code changes #

Change the IP address

Open the file src/index.ts in an editor. Replace 192.168.178.28 with the IP address of your ESP32. Save the file.

Change the repository name

In order to show the number of stars and forks of your favourite repository, we have to change the name of the repository. There is a variable called repoName with the value angular/angular. Change the value accordingly. The name of the repository always has to include the organisation name or username as well. https://github.com/angular/angular becomes angular/angular.

Install dependencies #

In order to install all dependencies, you have to run

npm i

Run the application #

You can start the application with

npm run start

When everything runs as expected you should see a log in the terminal. The application should call the REST API of the matrix display in order to show the number of stars and forks. After executing the command, it may take a moment before you see the first text on the matrix display.