tics

command module
v0.0.0-...-f18c969 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2018 License: MIT Imports: 6 Imported by: 0

README

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!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package domain contains the domain entities and domain logic necessary for the thumbnail image cache.
Package domain contains the domain entities and domain logic necessary for the thumbnail image cache.
Package usecases is the bridge between the domain and the interfaces
Package usecases is the bridge between the domain and the interfaces

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL