Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reddec/api-notes
Dead simple service for publishing notes via API. Markdown supported.
https://github.com/reddec/api-notes
api-first markdown notes openapi pastebin self-hosted
Last synced: 3 days ago
JSON representation
Dead simple service for publishing notes via API. Markdown supported.
- Host: GitHub
- URL: https://github.com/reddec/api-notes
- Owner: reddec
- License: mit
- Created: 2023-06-07T15:04:06.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-06-15T14:46:44.000Z (over 1 year ago)
- Last Synced: 2025-01-16T07:29:11.812Z (9 days ago)
- Topics: api-first, markdown, notes, openapi, pastebin, self-hosted
- Language: Go
- Homepage:
- Size: 68.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# API-Notes
Dead simple service for publishing notes via API. Markdown supported.
The service exposes minimal API for upload markdown (with attachments) and render it as HTML.
The generated link is 16-bytes randomly generated and can be shared relatively safely.
The API-Notes is NOT serving notes - any reverse proxy must do it. With authorization if needed.
See [docker-compose.yaml](docker-compose.yaml).Supported markdown extensions:
- GFM (GitHub Flavored Markdown)
- Footnotes
- Basic syntax highlighting
- Mermaid
- MathJax
- Embedded youtube## Installation
- Docker: `ghcr.io/reddec/api-notes:latest`
- Go: `go install github.com/reddec/api-notes/cmd/...@latest`## Usage
```
Usage:
api-notes [OPTIONS] serve [serve-OPTIONS]Help Options:
-h, --help Show this help message[serve command options]
-u, --public-url= Public URL for redirects (default: http://127.0.0.1:8080) [$API_NOTES_PUBLIC_URL]
-b, --bind= API binding address (default: 127.0.0.1:8080) [$API_NOTES_BIND]
-d, --dir= Directory to store notes (default: notes) [$API_NOTES_DIR]
-t, --token= Authorization token, empty means any token can be usedauth is disabled [$API_NOTES_TOKEN]```
Differences in docker version
| Environment variable | Default | Description |
|----------------------|----------------|---------------------|
| `API_NOTES_BIND` | `0.0.0.0:8080` | Binding address |
| `API_NOTES_DIR` | `/data` | Directory for notes |## API
- [OpenAPI spec](openapi.yaml)
- [Live docs](https://elements-demo.stoplight.io/?spec=https://raw.githubusercontent.com/reddec/api-notes/master/openapi.yaml)
- [![](https://godoc.org/github.com/reddec/api-notes/api/client?status.svg)](http://godoc.org/github.com/reddec/api-notes/api/client) generated Go API client### Example
Create note
curl -v -F author=reddec -F title=hello -F text=world -F [email protected] http://127.0.0.1:8080/notes?token=deadbeaf
From Go
```go
package mainimport (
"context"
"log""github.com/reddec/api-notes/api/client"
)func main() {
// we assume that we are somehow passing parameters (flags, envs...)
const URL = "https://example.com"
const Token = "deadbeaf"
notes, err := client.NewClient(URL, client.HeaderToken(Token))
if err != nil {
// panic is used for illustration only
panic("create notes client: " + err.Error())
}
note, err := notes.CreateNote(context.Background(), &client.DraftMultipart{
Title: "Hello",
Text: "## hello world\nThis is sample text",
Author: client.NewOptString("demo"),
})
if err != nil {
panic("create note: " + err.Error())
}log.Println("Note ID:", note.ID)
log.Println("Note URL:", note.PublicURL)
}
```## Sample note
![Screenshot 2023-06-07 230208](https://github.com/reddec/api-notes/assets/6597086/c5b7b999-ea25-4fb2-996d-bf8f6a6e9c0d)