update readme
This commit is contained in:
parent
332d78badd
commit
aa1af01174
25
README.md
25
README.md
|
@ -2,22 +2,33 @@
|
|||
|
||||
### 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 -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 built before using them. A build command exists for that purpose.
|
||||
Type checkers, controllers and middlewares have to be compiled beforehand. A build command exists for that purpose.
|
||||
```bash
|
||||
aicra [options] .
|
||||
aicra <project-folder>
|
||||
```
|
||||
|
||||
**Options**
|
||||
- If you want the *controller* folder different than `controller` define it with `-c`
|
||||
- If you want the *middleware* folder different than `middleware` define it with `-m`
|
||||
- If you want the *type checker* folder different than `types` define it with `-t`
|
||||
|
||||
### 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 `<some-url>.
|
Loading…
Reference in New Issue