Since Gleam’s syntax is different from most other languages, I thought it would be more enjoyable if we compared it with another language as we’re

Building the same app in Gleam and JavaScript

submited by
Style Pass
2024-12-24 18:30:06

Since Gleam’s syntax is different from most other languages, I thought it would be more enjoyable if we compared it with another language as we’re building the app.

To focus on the language itself, we will build a simple CLI todo app, something everybody is familiar with. Here’s a video of what the app would look like.

We will implement four commands: list to list all todos, add to add a new todo, done to mark multiple todos as done, and clear to delete all todos.

Before continuing, I encourage you to check out the code on GitHub first to get a better idea of how we’re going to build it.

To make explaining things as clear as possible, I will break the article into sections where every two sections show how to implement something in JavaScript and then in Gleam.

In this example, I will be using Node v20 and ESM modules. For this example, I will not use any third-party libraries, but it’s still a good practice to create a new package.json file.

Leave a Comment