Links Shortener is a web application that allows you to shorten your URL links. It provides an API for link shortening and a website for user interaction.
To host the application locally, follow the instructions below.
-
Navigate to the
api
directory:$ cd api
-
Install Go and its required packages. Run the following command to install the Go packages:
$ go mod tidy
-
Set up a MongoDB database and add the database URI to the
.env
file in theapi
directory:MONGOURI="MONGODB_URI_HERE"
-
Once you have added the MongoDB URI, start the API server:
$ go run main.go
-
Navigate to the
website
directory:$ cd website
-
Install Node.js and the required npm packages. Similar to the API setup, run the following command to install the npm packages:
$ npm install
-
Make a file named
.env
in thewebsite
directory, then add your API URL:PUBLIC_API_URL="http://localhost:8080"
-
Before starting the website server, ensure that the API server is already running. Follow the API setup instructions mentioned above. Once the API server is running, start the website server using the following command:
$ npm run dev