blob: 0998e74d74f4af0a0cb5a27971de488a5596c955 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# jim-bot
Web interace which generates 10 sentences of random corporate gibberish.
Based on [pocket-jim][]. Ported from C to [Go][].
## Usage
Build and run container using [Podman][]:
# clone git repo
git clone https://git.pablotron.org/jim-bot
# switch to cloned directory
cd jim-bot
# build container
podman build -t jim-bot:latest .
# run container bound to localhost:8080
podman run -d -p 8080:8080 --restart=on-failure --name jim-bot jim-bot:latest
Then open <http://localhost:8080/> in your browser.
By default the sentences are returned as plain text delimited by
newlines. If the request method is POST and the `Accept` header is set
to `application/json`, then the sentences are returned as a
[JSON][]-encoded array.
Example:
$ curl -X POST -H 'accept: application/json' http://localhost:8080/
["uniquely myocardinate communities",...
## Build
To build locally (requires [Go][]):
# build ./jim-bot
make
# run jim-bot on localhost:8080
./jim-bot
Then open <http://localhost:8080/> in your browser.
## Tests
Running tests:
# run unit tests
make test
# run `go vet` and `staticcheck`
make check
Note: The `check` target requires [staticcheck][].
[pocket-jim]: https://pmdn.org/pocket-jim
"pocket jim"
[podman]: https://podman.io/
"podman"
[go]: https://go.dev/
"Go programming language"
[staticcheck]: https://staticcheck.dev/docs/
"Go static analyzer."
[json]: https://json.org/
"JavaScript Object Notation"
|