Express JS: Minimal, Flexible and Spid
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.
Now that I have the project set, I started with configuring the run commands inside package.json
and then I can make the entry point of the project which will be the index.js
file.
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.
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.