-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rebuild Readme.md and fix some typos
- Loading branch information
Jian Liao
committed
May 18, 2022
1 parent
d4c0ff3
commit a5029ac
Showing
4 changed files
with
75 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,97 @@ | ||
# lcs-png-diff-server | ||
Pass in before and after bitmap URL, then the server will generate lcs diff png and return the diff result URL in response. | ||
Pass in before and after bitmap URL, and then the server will generate LCS diff png and return the diff result URL in response. | ||
|
||
## Server start options | ||
## Getting Started | ||
|
||
### Start server | ||
### Install and start server | ||
|
||
``` bash | ||
lcs-png-diff-server | ||
``` | ||
or | ||
``` bash | ||
docker run --rm -it -p 8080:8080 jianliao/lcs-png-diff-server:latest | ||
``` | ||
|
||
### Customize response URL | ||
$ cargo install lcs-png-diff-server | ||
|
||
``` bash | ||
HOST_INFO=https://localhost:443/ lcs-png-diff-server | ||
``` | ||
or | ||
``` bash | ||
docker run --rm -it -e HOST_INFO=https://localhost:443/ -p 8080:8080 jianliao/lcs-png-diff-server:latest | ||
$ lcs-png-diff-server | ||
``` | ||
|
||
## Example Request and Response | ||
|
||
### Request payload | ||
### Request | ||
|
||
``` bash | ||
curl \ | ||
-d '{ | ||
"before_png": "http://localhost:3000/fixtures/slider.png", | ||
"after_png": "http://localhost:3000/fixtures/slider_after.png" | ||
"before_png": "https://jianliao.github.io/lcs-test-pngs/before.png", | ||
"after_png": "https://jianliao.github.io/lcs-test-pngs/after.png" | ||
}' \ | ||
-H 'Content-Type: application/json' \ | ||
-X POST http://localhost:8080/api/diff | ||
``` | ||
|
||
### Response payload | ||
### Example response payload | ||
|
||
``` json | ||
{ | ||
"result_url": "http://localhost:8080/assets/b02d9094-bc6c-4c40-923e-50c66bcf1951.png" | ||
} | ||
``` | ||
|
||
## Server startup options | ||
|
||
``` bash | ||
$ lcs-png-diff-server --help | ||
lcs-png-diff-server | ||
A server for generating diff bitmaps from png files | ||
|
||
USAGE: | ||
lcs-png-diff-server [OPTIONS] | ||
|
||
OPTIONS: | ||
-a, --addr <ADDR> set the listen addr [default: 0.0.0.0] | ||
-h, --help Print help information | ||
-l, --log <LOG_LEVEL> set the log level [default: info] | ||
-p, --port <PORT> set the listen port [default: 8080] | ||
--static-dir <STATIC_DIR> set the directory where static files are to be found [default: | ||
./assets] | ||
``` | ||
|
||
### Customize the hostname of the response URL | ||
|
||
You can customize the hostname of the diff result URL by setting the `HOST_INFO` environment variable. | ||
|
||
``` bash | ||
HOST_INFO=https://localhost:443/ lcs-png-diff-server | ||
``` | ||
|
||
## Docker | ||
|
||
[jianliao/lcs-png-diff-server](https://hub.docker.com/repository/docker/jianliao/lcs-png-diff-server) is a demo-only docker image. CORS had enabled for GET and POST. | ||
|
||
### Start server | ||
|
||
``` bash | ||
$ docker run --rm -it -p 8080:8080 jianliao/lcs-png-diff-server:0.1.4 | ||
``` | ||
|
||
### Print CLI help | ||
|
||
``` bash | ||
$ docker run --rm -it jianliao/lcs-png-diff-server:0.1.4 --help | ||
``` | ||
|
||
### Change port number | ||
|
||
``` bash | ||
$ docker run --rm -it -p 3000:3000 jianliao/lcs-png-diff-server:0.1.4 -p 3000 | ||
``` | ||
|
||
### Change log level | ||
|
||
``` bash | ||
$ docker run --rm -it -p 8080:8080 jianliao/lcs-png-diff-server:0.1.4 -l debug | ||
``` | ||
|
||
### Customize response URL | ||
|
||
``` bash | ||
$ docker run --rm -it -e HOST_INFO=https://domainname/ -p 8080:8080 jianliao/lcs-png-diff-server:0.1.4 | ||
``` | ||
|
||
## LICENSE | ||
|
||
Apache License Version 2.0 | ||
Apache License Version 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters