Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomwright/mermaid-server
Go implementation of a HTTP server to allow remote generation of mermaid-js diagrams without any pre-requisites installed locally.
https://github.com/tomwright/mermaid-server
diagram diagram-generator http mermaid mermaid-charting-language mermaid-cli mermaid-diagrams mermaidjs
Last synced: 13 days ago
JSON representation
Go implementation of a HTTP server to allow remote generation of mermaid-js diagrams without any pre-requisites installed locally.
- Host: GitHub
- URL: https://github.com/tomwright/mermaid-server
- Owner: TomWright
- Created: 2020-04-06T22:23:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-28T12:53:30.000Z (8 months ago)
- Last Synced: 2024-10-22T20:34:21.776Z (21 days ago)
- Topics: diagram, diagram-generator, http, mermaid, mermaid-charting-language, mermaid-cli, mermaid-diagrams, mermaidjs
- Language: Go
- Homepage:
- Size: 284 KB
- Stars: 311
- Watchers: 10
- Forks: 43
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mermaid-server
Use mermaid-js to generate diagrams in a HTTP endpoint.
While this currently serves the diagrams via HTTP, it could easily be manipulated to server diagrams via other means.
## Basic usage
### Docker
Run the container:
```
docker run -d --name mermaid-server -p 80:80 tomwright/mermaid-server:latest
```### Manually as a go command
Start the HTTP server:
```
go run cmd/app/main.go --mermaid=./mermaidcli/node_modules/.bin/mmdc --in=./in --out=./out
```### Diagram creation
Use the query param 'type' to change between 'png' and 'svg' defaults to 'svg'.
#### POST
Send a CURL request to generate a diagram via `POST`:
```
curl --location --request POST 'http://localhost:80/generate' \
--header 'Content-Type: text/plain' \
--data-raw 'graph LRA-->B
B-->C
C-->D
C-->F
'
```#### 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")
### Caching
All generated diagram input and output will be cached for 1 hour. The cache time is reset whenever a cached diagram is accessed.