Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 925 Bytes

File metadata and controls

44 lines (27 loc) · 925 Bytes

Template Plugin: JSON Samples

This sample demonstrates, how to create JSON from a template and how to read JSON.

Use the template plugin to create body content from a template. Placeholders in the template can be filled with values from variables.

Running the Example

Execute the following steps:

  1. Go to the examples/templating/json directory.

  2. Have a look at proxies.xml.

  3. Open a commandline and execute membrane.sh or membrane.cmd

  4. Run this command from a second commandline:

    curl "http://localhost:2000/json?answer=42"

    The output should be:

    { "answer": 42 }
  5. Then execute:

    curl -d '{"city":"Berlin"}' -H "Content-Type: application/json" "http://localhost:2000"
      

    Expect the response:

    City: Berlin  
    

See: