tiny-url-ex/README.md

34 lines
1.1 KiB
Markdown
Raw Normal View History

# xdrm go framework
2020-03-03 19:06:09 +00:00
### 1. Download and build the package
```bash
2020-03-03 19:06:09 +00:00
go get -u git.xdrm.io/go/tiny-url-ex
```
### 2. launch in docker
Build the image.
```bash
$ docker build -t tiny-url .
```
Then you can run the container with :
```bash
$ docker run -p 127.0.0.1:8888:4242 tiny-url
2018-10-01 19:37:22 +00:00
```
You can now play with it with any regular REST API client at `127.0.0.1:8888`.
2018-10-01 19:37:22 +00:00
##### 1. Get an authentication token
2020-03-03 19:06:09 +00:00
2018-10-01 19:37:22 +00:00
- `POST /token/admin` to get an authentication token.
#### 2. Manage tiny urls
2020-03-03 19:06:09 +00:00
> 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.
2018-10-01 19:37:22 +00:00
- `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>`.
2020-03-03 19:06:09 +00:00
- `GET /<some-url>` to redirect to the target of an existing url `<some-url>`.