Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dan-mba/url-shortener
Fastify app URL shortener
https://github.com/dan-mba/url-shortener
fastify fetch javascript mongodb mongoose nodejs typescript
Last synced: 2 months ago
JSON representation
Fastify app URL shortener
- Host: GitHub
- URL: https://github.com/dan-mba/url-shortener
- Owner: dan-mba
- Created: 2019-11-18T12:51:35.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-30T09:49:42.000Z (2 months ago)
- Last Synced: 2024-11-01T23:30:33.498Z (2 months ago)
- Topics: fastify, fetch, javascript, mongodb, mongoose, nodejs, typescript
- Language: TypeScript
- Homepage: https://mixed-hail.glitch.me
- Size: 1.74 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# URL Shortener Microservice
### POST API
1. I can POST a URL to `[url]/api/shorturl/new` and I will receive a shortened URL in the JSON response. Example : `{"original_url":"https://www.google.com","short_url":2}`
2. If I pass an invalid URL that doesn't follow the valid `http(s)://www.example.com(/more/routes)` format, the JSON response will contain an error like `{"error":"invalid URL"}`.
3. When I visit the shortened URL, it will redirect me to my original link.#### Creation Example:
POST [url]/api/shorturl/new - body (urlencoded) : url=https://www.google.com
#### Usage:
[url]/api/shorturl/2
#### Will redirect to:
https://www.google.com