This is a simple URL shortener written in Go using the Gin web framework. It allows users to create short URLs that redirect to longer URLs.
- Clone the repository: git clone https://github.com/ghostdev-labs/GoUrlShortener.git
- Install dependencies: go mod download
- Start the server: go run main.go
- Navigate to http://localhost:8080 in your web browser
- Enter a long URL and click "Shorten"
- Copy the shortened URL and use it to redirect to the original long URL
The application uses environment variables for configuration. You can set these variables in a .env file in the root directory of the project. Here are the available variables:
- DB_CONNECTION_STRING: The connection string for the MySQL database. Example: DB_CONNECTION_STRING=db_user:db_password@tcp(db_host:db_port)/db_name?charset=utf8&parseTime=True&loc=Local
- PORT: The port number for the server to listen on. Example: PORT=8080
Contributions are welcome! Please open an issue or pull request if you find a bug or have a feature request.
This project is licensed under the MIT License - see the LICENSE file for details.