Shorten URL API is a simple API built with Fastify, PostgreSQL and Redis to shorten long URLs and track access metrics.
- Make sure you have Node.js and npm installed on your machine.
- Clone this repository:
git https://github.com/AdrianoVolter/encur_URL.git
cd encur_URL
npm install
Configure PostgreSQL and Redis by editing the src/lib/postgres.ts and src/lib/redis.ts files, respectively.
npm run dev
- 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.
Fastify:Fast and efficient web framework for Node.js. PostgreSQL: Relational database for storing shortened links. Redis: In-memory database for storing access metrics.