Tiny URL example implementation in Go with the 🔥 Aicra framework.
Go to file
Adrien Marquès b92c7d0935 add license 2020-03-29 17:37:10 +02:00
service use models for api handler output instead of creating a copied struct 2020-03-29 17:30:36 +02:00
.drone.yml ci: simplify 2019-05-04 00:08:38 +02:00
.gitignore update 2018-07-07 23:09:19 +02:00
Dockerfile docker: use entrypoint instead of cmd 2020-03-09 19:16:27 +01:00
LICENSE add license 2020-03-29 17:37:10 +02:00
README.md update readme according to new Dockerfile 2020-03-09 19:01:48 +01:00
api.json make config fields exported in Go (capitalize) 2020-03-29 17:03:08 +02:00
go.mod make service structs more readable 2020-03-29 17:24:35 +02:00
go.sum bcupdate: aicra@0.3.0 new configuration and service examples : articles/users 2020-03-22 13:49:08 +01:00
main.go use models for api handler output instead of creating a copied struct 2020-03-29 17:30:36 +02:00

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 the GET 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 named target. 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 named target.
  • 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>.