This is a simple URL shortener service implemented in Go using MongoDB as the database. It generates unique and shortened aliases for long URLs and provides real-time redirection to the original links.
- Generates unique and short aliases for long URLs
- Redirects users to the original link when a short URL is accessed
- Links expire after a configurable default time span
- Highly available and designed for minimal latency
- Go programming language
- MongoDB database
-
Make sure Go is installed on your system. If not, refer to the official Go installation guide.
-
Install the necessary Go packages:
-
Install and set up MongoDB on your local machine or a remote server. Refer to the official MongoDB documentation for instructions.
-
Clone this repository:
-
Update the MongoDB connection URL in the
repository/url_repository.go
file:
options.Client().ApplyURI("mongodb://localhost:27017")
Replace "mongodb://localhost:27017" with the appropriate MongoDB connection URL.
- Build and run the application:
go run main.go
- Make sure to install docker on your machine
- Run
docker-compose up