Member-only story
Make a Simple URL Shortener app with Node.js & Express.js + Rest API
Have you ever thought to learn a Node.js
? Trying out simple projects such as ToDoApps & WeathersApp will help you learn new things quickly so I decided to create a simple URL shortener with Node.js
& Express.js
and become familiar with Node.js
Applications. To make this Application we follow the below steps:
👋 Initial Step
First, we need to create a fresh folder, we called it nodejs-url-shortener
after that we have to make package.json
with follow commands:
$ yarn init
This command helps you to make the package.json
with some question like project name, version, license, repository, etc. Our dependencies will now be installed via the following command:
$ yarn install -D mongoose express nodemon ejs
NOTE: Please make sure you installed MongoDB on your computer
Let me now explain a little about the package we installed, in our case we install nodemon
to reload our application after a single change without the need to stop/start the app, we use MongoDB
to save our data in a simple database and also we install express
to handle the HTTP Requests. if you want to make a simple view for your application you need to install ejs
too.