A simple API to parse long URL to a shorter version, and retrieve the longer version from the latter.
URLShortener builds upon libz, Boost, Served, and Crypto++.
- ✅ Shorten longer URL
- ✅ Retrieve original long URL from a short one, if possible
- [Required] - libz
- [Required] - Boost (1.78 or newer)
- [Required] - Served (1.0 or newer)
- [Required] - Crypto++ (8.6 or newer)
- [Required] - CMake (3.14 or newer)
- [Required] - C++ (17 or newer)
Endpoint | Purpose |
---|---|
/encode | shorten a URL |
/decode | try to retrieve longer version of a URL |
For detailed information see ../Auxiliary/Documentation/html/index.html
OS | Compiler | Status |
---|---|---|
OSX Intel | Clang 13.0 | Working |
OSX Intel | Clang 12.0.5 | Working |
OSX ARM | Clang 12.0.5 | Working |
$ git clone https://github.com/megibyan/URLShortener.git
$ cd URLShortener
$ mkdir Build && cd Build
$ cmake ../ && make -j12
or use Build.sh
located at Auxiliary/Scripts
$ ./Build
$ ./URLShortener
In a separate tab:
$ curl --header "Content-Type: application/string" --request POST --data "google.com" http://localhost:8080/encode
$ curl --header "Content-Type: application/string" --request POST --data "https://url.short/KbLNv" http://localhost:8080/decode
or use URLShortener.sh
(on Intel only) located at Auxiliary/Scripts
$ cd ../URLShortener/Scripts
$ ./URLShortener -e "google.com"
$ ./URLShortener -d "https://url.short/KbLNv"
$ cd ../Build
$ make Test -j12 && ./Test
or use Test.sh
located at Auxiliary/Scripts
$ ./Test
- Support for other OSs.
- This should be as simple as building third party dependencies for the platforms.
- Third party dependencies should have better place to live.
- Current encoding guarantees the uniqueness but doesn't guaranty the short URL length.