Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/otaaaviio/link-shortener
https://github.com/otaaaviio/link-shortener
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/otaaaviio/link-shortener
- Owner: otaaaviio
- Created: 2024-06-24T23:54:18.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-25T15:51:41.000Z (5 months ago)
- Last Synced: 2024-06-26T16:20:02.769Z (5 months ago)
- Language: PHP
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Link shortener
## Description
It's a simple **link shortener** that uses a hash function to generate a short link for a given URL and saves it in a PostgreSQL and Redis.## Requirements
- [Docker](https://docs.docker.com/get-docker/)
- [Bash](https://www.gnu.org/software/bash/)## Installation
1. Clone the repository
```bash
git clone https://github.com/otaaaviio/link-shortener.git
```2. Enter the project directory
```bash
cd link-shortener
```3. Run the installation script
```bash
./bin/setup.sh
```## Usage
1. Start the application
```bash
./bin/start.sh
```2. Now, you can send the following requests to the API:
- POST -> `http://0.0.0.0:80/api/findOrCreate`:
```json
{
"original_url": "https://www.example.com"
}
```Will return:
```json
{
"shortened_url": "http://0.0.0.0:80/api/{hashedUrl}"
}
```
- GET -> `http://0.0.0.0:80/api/{hashedUrl}`## Tests
To run the tests, you can use the following command:
```bash
./vendor/bin/sail test
```ps: to run the tests, you need to have the application running.
## Collaboration
If you want to contribute to the project, you can fork the repository and create a pull request with your changes.
## Author
Otávio Gonçalves:
- [GitHub](https://github.com/otaaaviio)
- [Linkedin](https://www.linkedin.com/in/otaaaviio/)