Tiny URL example implementation in Go with the 🔥 Aicra framework.
Go to file
Adrien Marquès 2431a101ef
listen to every interface : no need to only listen on localhost in container
2020-03-09 18:58:49 +01:00
service remove psql, use in-memory storage only (non thread-safe) 2020-03-03 20:02:15 +01:00
.drone.yml ci: simplify 2019-05-04 00:08:38 +02:00
.gitignore update 2018-07-07 23:09:19 +02:00
Dockerfile container from scratch (5M) 2020-03-09 18:40:01 +01:00
README.md update readme 2020-03-03 20:06:09 +01:00
api.json new repo from git.xdrm.io/go/aicra@v0.2.0 2019-05-01 16:42:17 +02:00
go.mod update modules 2020-03-08 16:34:00 +01:00
go.sum update modules 2020-03-08 16:34:00 +01:00
main.go listen to every interface : no need to only listen on localhost in container 2020-03-09 18:58:49 +01:00

README.md

xdrm go framework

1. Download and build the package

go get -u git.xdrm.io/go/tiny-url-ex

2. launch the server

$ go run .

Now you can play with it with any regular REST API client at 127.0.0.1:4242.

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>.