Allows you to create short URL's and track the dynamics of redirects(clicks).
Private key is required for JWT signature generation. SmolURL
binary require path to .pem
file, by default private.pem
is used.
openssl genrsa -out private.pem 2048
docker build --tag smolurl .
Run local PostgreSQL instance(docker):
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
Run tests with:
RUST_BACKTRACE=1 cargo test -- --nocapture --test-threads=1
Basic JWT-based registration. Creates User
entry in database and returns Authorization Bearer Token
.
{
"username": "super1337",
"password": "1337"
}
Basic JWT-based login system. Validates Authorization Bearer Token
and password hash.
{
"username": "super1337",
"password": "1337"
}
Protected endpoint. Creates new Link
entry in database and returns it. Link
entry is associated with User
. Key(short URL) is generated based on unique User
id and personal url counter - encoded with base64.
{
"url": "http://example.com"
}
Protected endpoint. Returns all User
Link
's.
Protected endpoint. Returns specific User
Link
by unique key. Link
must be owned by User
.
It is what it is.
{
"id": 0,
"url": "http://example.com",
"key": "0dzFGd",
"userid": 0,
"count": 0
}