diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-04-11 12:58:11 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-04-11 12:58:11 -0700 |
| commit | 6401d100e8b616c65014ae7fd62ac9a575466bef (patch) | |
| tree | 299b9917aeec4c487063b3cbf0f5c4228f11d8ac /demo/rest/README.adoc | |
| parent | 2d59ddc18e0e947b75249634531e67e2499a57ab (diff) | |
| download | nng-6401d100e8b616c65014ae7fd62ac9a575466bef.tar.gz nng-6401d100e8b616c65014ae7fd62ac9a575466bef.tar.bz2 nng-6401d100e8b616c65014ae7fd62ac9a575466bef.zip | |
fixes #341 Want REST API gateway demo
Diffstat (limited to 'demo/rest/README.adoc')
| -rw-r--r-- | demo/rest/README.adoc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/demo/rest/README.adoc b/demo/rest/README.adoc new file mode 100644 index 00000000..6a363329 --- /dev/null +++ b/demo/rest/README.adoc @@ -0,0 +1,25 @@ += REST API Gateway demo + +This is a somewhat contrived demonstration, but may be useful +in a pattern for solving real world problems. + +There is a single "server" program, that does these: + +. REST API at /api/rest/rot13 - this API takes data from HTTP POST commands, + and forwards them to an NNG REQ socket. When the REQ response comes, + the reply is redirected back to the server. (For the purposes of the + demonstration, our server just performs ROT13 on input.) + +. REP server (implemented in the same program using inproc, for demonstration + purposes. In a real world scenario this might instead go to another + process on another computer.) + +[source, bash] +---- +% env PORT=8888 # default +% ./server & +% curl -d ABC http://127.0.0.1:8888/api/rest/rot13; echo +NOP +% curl -d ABC http://127.0.0.1:8888/api/rest/rot13; echo +ABC +---- |
