Minimalistic API serving as a URL Shortener Service
- TypeScript
- Express
- Prisma
- SQLite
- /shorten
Shortens Long URL and returns ShortCode
Method: POST
Headers
Content-Type: application/json
Example Request
curl -X POST -H 'Content-Type: application/json' -d '{"url": "https://youtube.com"}' localhost:3000/shortenResponse
{ "message": "Shortcode created successfully", "shortCode": "XYZ12DW" }StatusCode: 201
- /shorten/:shortCode
Redirects you to long URL
Method: GET
Example Request
curl localhost:3000/shorten/XYZ12DWError Response
{ "message": "Shortcode not found", }StatusCode: 404