README.asciidoc 1.3 KB

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