https://github.com/adrianovolter/encur_url
Encurtador de URL
https://github.com/adrianovolter/encur_url
docker-compose fastify nodejs postgresql redis sql typescript zod
Last synced: 3 months ago
JSON representation
Encurtador de URL
- Host: GitHub
- URL: https://github.com/adrianovolter/encur_url
- Owner: AdrianoVolter
- Created: 2024-03-20T02:36:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-20T13:06:52.000Z (over 2 years ago)
- Last Synced: 2026-01-03T16:19:40.773Z (6 months ago)
- Topics: docker-compose, fastify, nodejs, postgresql, redis, sql, typescript, zod
- Language: TypeScript
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Shorten URL API
Shorten URL API is a simple API built with Fastify, PostgreSQL and Redis to shorten long URLs and track access metrics.
## How to use
### Installation
1. Make sure you have Node.js and npm installed on your machine.
2. Clone this repository:
```bash
git https://github.com/AdrianoVolter/encur_URL.git
```
### Navigate to the project directory:
```bash
cd encur_URL
```
### Install dependencies:
```bash
npm install
```
### Configure PostgreSQL and Redis by editing the src/lib/postgres.ts and src/lib/redis.ts files, respectively.
### Start the server
```bash
npm run dev
```
## Endpoints
- GET /:code: Redirects to the original URL corresponding to the provided code.
- GET /api/links: Returns all shortened links.
- POST /api/links: Shortens a long URL and returns the shortened link code.
- GET /api/metrics: Returns access metrics for shortened links.
## Technologies Used
Fastify:Fast and efficient web framework for Node.js.
PostgreSQL: Relational database for storing shortened links.
Redis: In-memory database for storing access metrics.