Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sigfriedcub1990/frodo-url-shortener
This is Frodo, the URL shortener 😊
https://github.com/sigfriedcub1990/frodo-url-shortener
Last synced: about 8 hours ago
JSON representation
This is Frodo, the URL shortener 😊
- Host: GitHub
- URL: https://github.com/sigfriedcub1990/frodo-url-shortener
- Owner: sigfriedCub1990
- Created: 2020-07-27T18:03:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-13T08:51:17.000Z (almost 2 years ago)
- Last Synced: 2023-03-05T12:21:49.947Z (over 1 year ago)
- Language: TypeScript
- Size: 345 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Frodo, the URL shortener
## Motivation
- To have fun building a simple `URL shortener` using a non-cryptographic hash
function from the [MurmurHash family](https://github.com/aappleby/smhasher). I chose
Murmurhash based on [this answer](https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed/145633#145633).
- To learn how to setup a simple environment using [Docker](https://docs.docker.com/get-docker/),
[Redis](https://redis.io/) and [Node.js](https://nodejs.org/en/).## Installation
```sh
# To run the URL shortener run the following `two` commands
docker-compose build
docker-compose up -d
# You can still use `redis` and run the `Gandalf` container :)
docker-compose build
docker-compose up -d redis
npm run dev
```## Usage
````sh
curl --data '{"url": "https://sigfried.xyz"}' --header 'Content-Type: application/json' http://localhost:3000/api/v1/shorten
# Response will be a JSON with an URL
```json
{ "url": "localhost:3000/c19fcdc5" }
```
# Next step is to put the returned URL in your browser
# and you'll be redirected to the original URL, i.e. https://sigfried.xyz.
````## Example API
- [Bit.ly](https://dev.bitly.com/api-reference)