Authored by mupinnn on September 22, 2020
Build your own RESTful API with Express.js!
![thumbnail](./img/thumbnail.jpeg)
This is a quick and simple blog content because I don't want to use lorem ipsum placeholder for this. So, I will make it very quick.
What is Express.js? Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. With a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy.
Installation
Create a new folder, named it whatever you want, and
run
npm init -y
. After initializing process done, open the
directory with your favorite code editor/IDE.
Next, install express dependencies with
npm i express
. After it done, create
app.js
on root of directory.
![folder](./img/folder-structure.png)
Getting it done
Then, write this in
app.js
![folder](./img/simple-express-api-snippets.png)
Run
node app.js
in your terminal. Don't forget to point the project
directory first before run that command. Open your
browser and visit
http://localhost:9000
, and voila! you will see
Hello world! showing.
Sorry for this bad content placeholder, I'm a bit lazy to write a proper content :|