Skip to content

c-ameron/go-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-color

A simple go app to convert a hex color to RGB

$ curl localhost:8080/convert?hex=ff0000
RGB(255, 0, 0)

Any query which isn't the example format will result in a HTTP 400 error

$ curl localhost:8080/convert?bad=query -i
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Fri, 14 Jun 2019 09:09:05 GMT
Content-Length: 50

Bad query, please use format: /convert?hex=ff0000

There's also a /status endpoint

$ curl localhost:8080/status -i
HTTP/1.1 200 OK
Date: Fri, 14 Jun 2019 08:55:58 GMT
Content-Length: 3
Content-Type: text/plain; charset=utf-8

OK

How To Build & Run

Golang

go build
./go-color

Docker

docker build --pull --force-rm -t go-color .
docker run -p 8080:8080 go-color

Configuration

To change the listening port, set the LISTEN_PORT environment variable. The default is 8080

LISTEN_PORT=9000 ./go-color

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published