Adrien Marquès f31adca326 | ||
---|---|---|
service | ||
.drone.yml | ||
.gitignore | ||
Dockerfile | ||
README.md | ||
api.json | ||
go.mod | ||
go.sum | ||
main.go |
README.md
xdrm go framework
1. Download and build the package
go get -u git.xdrm.io/go/tiny-url-ex
2. launch in docker
Build the image.
$ docker build -t tiny-url .
Then you can run the container with :
$ docker run -p 127.0.0.1:8888:4242 tiny-url
You can now play with it with any regular REST API client at 127.0.0.1:8888
.
1. Get an authentication token
POST /token/admin
to get an authentication token.
2. Manage tiny urls
The authentication token must be set inside the
Authorization
header of each request except for theGET
method which does not require you to be authenticated.
POST /<some-url>
to set a new tiny-url for the url<some-url>
to redirect to the FORM variable namedtarget
. Also you can send the FORM data as x-www-form-urlencoded, form-data or json.PUT /<some-url>
to update an existing tiny-url for the url<some-url>
to redirect to the FORM variable namedtarget
.DELETE /<some-url>
to delete the tiny-url for<some-url>
.GET /<some-url>
to redirect to the target of an existing url<some-url>
.