Skip to content

co0p/tics

Repository files navigation

Go Report Card

TICS - Thumbnail Image Caching Service

A proof of concept implementation of a clean-architecture (see uncle bob's clean architecture description) with an image caching service as the main use-case.

  • The domain is the thumbnail.
  • The usecase is the image resizing and storing part.
  • The interface of the system is a webservice and storage abstraction.
  • The infrastructure implements the concrete resizer, storage etc systems.

how to run

install the dependencies, build the binary and start it

$ dep ensure
$ go build
$ ./tics 

To set the port, export the environment variable "TICS_PORT"

$ export TICS_PORT="8888"
$ ./tics # will start listening on port 8888

how to use

The tics service is using a base64 encoded url including width and height resizing information:

should be converted into the following pattern:<url>?w=<width>&h=<height>. Finally run all this through a base64 encoder and you are good to go:

Now you have a nice base64 encoded image path and some resizing information. Call the service with

  • localhost:8080/?i=<base64encoded...>
  • localhost:8080/?i=aHR0cHM6Ly93d3cud2lraXBlZGlhLm9yZy9wb3J0YWwvd2lraXBlZGlhLm9yZy9hc3NldHMvaW1nL1dpa2lwZWRpYS1sb2dvLXYyLnBuZz93PTIwJmg9MjA=

and you get a nice small wikipedia image.

run tests

cd /path/to/tics and then go test ./....

License

This project is licensed under MIT license. Use at your own risk and will!

About

Thumbnail image caching service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages