This Git repository contains a Tiny URL software implemented in the Go programming language. The software provides a web-based service that converts long URLs into short, more manageable URLs. Users can input a long URL, and the software generates a unique short URL that redirects to the original long URL.
- Clone the repository: git clone https://github.com/your-username/your-project.git
- Change to the project directory:
$ cd URL_SHOTNER_APPLICATION/- Install dependencies:
$ go get -d -v $(cat dependencies.txt)- Set up the environment variables:
DATABASE_URL: Connection string to your PostgreSQL databasePort: Add your desire PORT
- Migrate the models
go run migrate/migrate.go - Get the build of project:
$ go build -o URl_SHORTNER_APPLICATION - Run the project:
$ go run main.go- Sign up: Send a POST request to
/signupwith the following JSON body:{ "username": "your-username", "password": "your-password" } - Log in: Send a POST request to
/loginwith the same JSON body. You'll receive a JWT token in the response.
-
Authenticate: Include the JWT token in the
Authorizationheader for subsequent requests. -
Create a short URL: Send a POST request to
/urlwith the following JSON body: Get all URLs: Send a GET request to/allto retrieve a list of all created URLs. -
Redirection: Access a short URL by navigating to
http://localhost:8080/your-shortcode. You'll be redirected to the original long URL.
-
Fork the repository.
-
Create a new branch:
git checkout -b feature-new-feature -
Make your changes and commit:
git commit -m "Add new feature -
Push to the branch:
git push origin feature-new-feature -
Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.