Skip to content

etilite/qr-coder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qr-coder

docker pulls docker push go build codecov

Lightweight microservice written in Go to generate QR-codes in png format.

By default, qr-coder adds to content UTF-8 BOM prefix for better unicode-compatibility with scanners.

Usage

Quick Start with Docker

docker run --rm -p 8080:8080 -e HTTP_ADDR=:8080 etilite/qr-coder:latest

This will start the service and expose its API on port 8080.

API

Request

  • POST /generate
{
  "size": 256,
  "content": "https://github.com/etilite/qr-coder"
}
  • size in pixels of image side, int
  • content is a string to encode, string

Request Example:

Using cURL, you can make a request like this:

curl --location 'localhost:8080/generate' \
--header 'Content-Type: application/json' \
--data '{
  "size": 256,
  "content": "https://github.com/etilite/qr-coder"
}' -o img.png

Response

The response will be a binary PNG file with the encoded content.

response

Build from source

git clone https://github.com/etilite/qr-coder.git
cd qr-coder
make run

This will build and run app at http://localhost:8080.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

If you'd like to contribute to the project, please open an issue or submit a pull request on GitHub.