Express JS: Minimal, Flexible and Spid

Cornelius Tantius
Bina Nusantara IT Division
2 min readNov 17, 2022
Photo by Gabriel Heinzer on Unsplash

For the last 2 years, I’ve been working fulltime as a backend software engineer while pursuing my bachelor degree and during work, the language I often use in my work projects is C#. At this phase, I started to get bored of the language and framework I use and I somehow wanted to try different language and framework environment. So I decided to create an Express JS project since I’ve heard it couple times and I’m surprised that it is actually THAT easy to create API using Express that it only took me couple minutes.

For this project, the framework I will be utilizing is node JS with Express module. So of course, the first thing I do is initiate my project. All I have to do is usethe usual node command to initialize project and install Express and Dotenv module.

Initializing The Project Base

Now that I have the project set, I started with configuring the run commands inside package.jsonand then I can make the entry point of the project which will be the index.js file.

package.json script
index.js contents

As you can see above, the code is just that simple and it is indeed that clean.

Now that I have the run configuration and entry point created, I need to add environment file which I use to store the port value. So I created .env file and added the port value inside.

.env file

With those things setup above I can just run the project now with npm run dev command and I already have my API server running.

I am so surprised that creating API was this easy nowadays with such minimal configuration and effort.

--

--