URL shortener service
This solution uses Docker and Docker Compose.
# Install dependencies (required for development with hot reload)
npm install
# Run the service
docker compose up
# Create a new short URL
curl -X POST -H "Content-Type: application/json" \
-d '{"original_url": "https://github.com/brenobaptista"}' \
http://localhost:3000/urls
# Get the original URL back
curl http://localhost:3000/{hash}
# Stop and remove containers and networks created by "up" (keep volumes and images).
docker compose down
# Stop and remove containers, networks, images and volumes created by "up".
docker compose down --rmi all -vConnect to the PostgreSQL database using any SQL client (e.g., Beekeeper Studio, pgAdmin, DBeaver):
| Property | Value |
|---|---|
| Host | localhost |
| Port | 5432 |
| Database | url_shortener |
| User | user |
| Password | password |
| Breno Baptista |
This project is licensed under the MIT License