sc0ttj / mdsh

A simple static site generator, using Markdown and Bash
https://sc0ttj.github.io/mdsh/
10 stars 0 forks source link

How to: test local test APIs #80

Open sc0ttj opened 5 years ago

sc0ttj commented 5 years ago

Do this after cgi-bin is working and mdsh can build pages with some kind of bash-cgi stuff: https://github.com/sc0ttj/mdsh/issues/34

See: https://github.com/micha/resty

Source the script before using it.

  $ . resty

Once resty is installed, set your REST host to which you will be making your requests.

  $ resty http://127.0.0.1:8080/data
  http://127.0.0.1:8080/data*

And now you can Make some HTTP requests.

  $ GET /blogs.json
  [ {"id" : 1, "title" : "first post", "body" : "This is the first post"}, ... ]

  $ PUT /blogs/2.json '{"id" : 2, "title" : "updated post", "body" : "This is the new."}'
  {"id" : 2, "title" : "updated post", "body" : "This is the new."}

  $ DELETE /blogs/2

  $ POST /blogs.json '{"title" : "new post", "body" : "This is the new new."}'
  {"id" : 204, "title" : "new post", "body" : "This is the new new."}