Update readme

This commit is contained in:
Tom Wright 2020-08-09 11:04:33 +01:00
parent f1f2012a95
commit 2faebcd5b4
1 changed files with 14 additions and 3 deletions

View File

@ -20,7 +20,11 @@ Start the HTTP server:
go run cmd/app/main.go --mermaid=./mermaidcli/node_modules/.bin/mmdc --in=./in --out=./out
```
Send CURL request to generate a diagram via `POST`:
### Diagram creation
#### POST
Send a CURL request to generate a diagram via `POST`:
```
curl --location --request POST 'http://localhost:80/generate' \
--header 'Content-Type: text/plain' \
@ -33,9 +37,16 @@ curl --location --request POST 'http://localhost:80/generate' \
'
```
Or send CURL request to generate a diagram via `GET`... send in url encoded data under the `data` query param:
#### GET
Send a CURL request to generate a diagram via `GET`... send in url encoded data under the `data` query param:
```
curl --location --request GET 'http://localhost:80/generate?data=graph%20LR%0A%0A%20%20%20%20A--%3EB%0A%20%20%20%20B--%3EC%0A%20%20%20%20C--%3ED%0A%20%20%20%20C--%3EF%0A'
```
![Example request in Postman](example.png "Example request in Postman")
![Example request in Postman](example.png "Example request in Postman")
### Caching
All generated diagram input and output will be cached for 1 hour. The cache time is reset whenever a cached diagram is accessed.