Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 1.08 KB

README.md

File metadata and controls

57 lines (36 loc) · 1.08 KB

Dwarf

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.

How it works

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.

Development

Redis Store

Spin up an instance of redis with:

docker run -p "6379:6379" --rm --name dwarf-redis redis:4-alpine

Testing

go test github.com/LevInteractive/dwarf/ -v

Note that the tests relies on a running redis instance.