This is a simple shortened url exercise. For the exercise, use this documentation to build an API backend service, for simplyfy url link and use Base62 Encode method. We use base62 method to encode shortened Url because base62 encoder allows us to use the combination of characters and numbers which contains A-Z, a-z, 0–9 total( 26 + 26 + 10 = 62). So for 7 characters short URL, we can serve 62^7 ~= 3500 billion URLs which is quite enough in comparison to base10 (base10 only contains numbers 0-9 so you will get only 10M combinations). If we use base62 making the assumption that the service is generating 1000 tiny URLs/sec then it will take 110 years to exhaust this 3500 billion combination.
This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
Before we get started, it's important to know that that this code use a custom command to execute it with makefile to make more simple command like :
- make update
- make tidy
- make start
So, let start it.
- After clone this repository, just run
make update
. - Setup your
.env
file such as database connection and redis connection based on default setting on you device. - To make sure that all dependency is run well, than run
make tidy
. - Finally, you can run your project with command:
make start
. - Go to postman and set url like
http://localhost:8080/
, for information that port to run this project depend on configuratin on.env
And for additional information, i'm alredy setup unit-testing, just run make test-service
.
Here is more information on the process flow and API Contract documentation:
Hopefully, it can be easily understood and useful. Thank you~