Tiny URL example implementation in Go with the 🔥 Aicra framework.
Go to file
Adrien Marquès 477f96fe5c fix docker command (expose port on the machine) 2018-10-02 10:53:45 +02:00
controller.plugin rename err.BindArgument() to err.Put() 2018-10-01 21:21:33 +02:00
db token management is ok with middleware .. OK 2018-07-08 15:29:25 +02:00
middleware.plugin/1-auth compliant to new 'aicra' config 2018-10-01 19:29:38 +02:00
type compliant to new 'aicra' config 2018-10-01 19:29:38 +02:00
.gitignore update 2018-07-07 23:09:19 +02:00
README.md fix docker command (expose port on the machine) 2018-10-02 10:53:45 +02:00
aicra.json compliant to new 'aicra' config 2018-10-01 19:29:38 +02:00
api.json compliant to new 'aicra' config 2018-10-01 19:29:38 +02:00
main.go compliant to new 'aicra' config 2018-10-01 19:29:38 +02:00

README.md

xdrm go framework

1. Setup

You need a redis server running, if you don't have it, you can simply use a docker container for it with docker run -p 6379:6379 -d redis.

All commands above must be launched from the root of this repository.

2. Build type checkers, controllers, middlewares

Type checkers, controllers and middlewares have to be compiled beforehand. A build command exists for that purpose.

aicra <project-folder>

3. Launch the api

$ go run ./main.go

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.

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