A performant URL shortener written in Go using a Redis as a store while exposing an interface for others. Uses gRPC for communication for high throughput.
GET /{short-hash}
This will result in a 301 redirect or a 404 not found.
Creating new shortened URL's via gRPC
service Dwarf {
rpc Create(CreateRequest) returns (CreateResponse) {}
}
message CreateRequest {
repeated string urls = 1;
}
message CreateResponse {
repeated string urls = 2;
}
Your response will return a set of shortened urls in the same order:
{
"urls": ["http://sh.ort/Mp", "http://sh.ort/uJ"]
}
A way to interface with this is by using this node client.
- Protobuf/gRPC is required.
- Go & dep
Spin up an instance of redis with:
docker run -p "6379:6379" --rm --name dwarf-redis redis:4-alpine
go test github.com/LevInteractive/dwarf/ -v
Note that the tests relies on a running redis instance.