README.asciidoc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. = REST streaming example
  2. To try this example, you need GNU `make` and `git` in your PATH.
  3. To build and run the example, use the following command:
  4. [source,bash]
  5. $ make run
  6. Then point your browser to http://localhost:8080
  7. == About
  8. This example simulates streaming a large amount of data from a data store one
  9. record at a time in CSV format. It also uses a constraint to ensure that the
  10. last segment of the route is an integer.
  11. == Example output
  12. Fetch records with the second field with value 1:
  13. [source,bash]
  14. ----
  15. $ curl -i localhost:8080
  16. HTTP/1.1 200 OK
  17. transfer-encoding: identity
  18. server: Cowboy
  19. date: Sun, 10 Feb 2013 19:32:16 GMT
  20. connection: close
  21. content-type: text/csv
  22. DBUZGQ0C,1,28
  23. BgoQAxMV,1,6
  24. DAYEFxER,1,18
  25. ...
  26. ----
  27. Fetch records with the second field with value 4:
  28. [source,bash]
  29. ----
  30. $ curl -i localhost:8080/4
  31. HTTP/1.1 200 OK
  32. transfer-encoding: identity
  33. server: Cowboy
  34. date: Sun, 10 Feb 2013 19:34:31 GMT
  35. connection: close
  36. content-type: text/csv
  37. ABcFDxcE,4,42
  38. DgYQCgEE,4,5
  39. CA8BBhYD,4,10
  40. ...
  41. ----
  42. Fail to use a proper integer and get an error:
  43. [source,bash]
  44. ----
  45. $ curl -i localhost:8080/foo
  46. HTTP/1.1 404 Not Found
  47. connection: keep-alive
  48. server: Cowboy
  49. date: Sun, 10 Feb 2013 19:36:16 GMT
  50. content-length: 0
  51. ----