Add http driver to README
This commit is contained in:
parent
5e075f3a0c
commit
d83e290967
39
README.md
39
README.md
|
@ -47,6 +47,45 @@ Query the size of a directory in bytes by observing `<file-system-usage "/SOME/P
|
|||
]
|
||||
```
|
||||
|
||||
### HTTP driver
|
||||
|
||||
Experimental HTTP server that services requests using [some version](https://git.syndicate-lang.org/syndicate-lang/syndicate-protocols/src/commit/9864ce0ec86fb2f916c2aab318a1e6994ab8834c/schemas/http.prs) of the http Syndicate protocol schema.
|
||||
|
||||
```
|
||||
# Configuration example
|
||||
let ?not-found = dataspace
|
||||
$not-found ? <request _ ?res> [
|
||||
$res ! <status 503 "Service unavailable">
|
||||
$res ! <done "No binding here.">
|
||||
]
|
||||
|
||||
let ?greeting = dataspace
|
||||
$greeting ? <request _ ?res> [
|
||||
$res ! <status 200 "ok">
|
||||
$res ! <chunk "Hello world">
|
||||
$res ! <done "!">
|
||||
]
|
||||
|
||||
let ?http = dataspace
|
||||
$http [
|
||||
<http-bind #f 80 get [ ] $not-found>
|
||||
<http-bind #f 80 get [|...|] $not-found>
|
||||
<http-bind #f 80 get ["hello"] $greeting>
|
||||
]
|
||||
|
||||
? <service-object <daemon http-driver> ?cap> [
|
||||
$cap <http-driver { dataspace: $http }>
|
||||
]
|
||||
|
||||
<daemon http-driver {
|
||||
argv: [ "/bin/syndesizer" ]
|
||||
clearEnv: #t
|
||||
protocol: application/syndicate
|
||||
}>
|
||||
|
||||
<require-service <daemon http-driver>>
|
||||
```
|
||||
|
||||
### JSON Socket Translator
|
||||
|
||||
Communicate with sockets that send and receive lines of JSON using `<send …>` and `<recv …>` messages.
|
||||
|
|
Loading…
Reference in New Issue