Compound JS - Using POST method in API

I am working on CompoundJS and i would like to create an api for my mobile application.

Below is the expected output

1) An api localhost:3000/test

2) Some data has tobe POSTED to this api say number: 1

3) The API should respond with the number posted, result should be = 1

I tried the below

1) Created a controller say test_controller.js

2) Added an action showtest with below code

action(function showtest(req, res) {
  console.log(req.body);
});

3) Added router config like

map.post('test', 'test#showtest')

When i posted to the url localhost:3000/test, it shows like 200 successful, but in Firebug console the response shows error.

What am i doing wrong? is there anything as like Rails render :text => "hello" we can use it for CompoundJS.

Your action isn't correct. Try this:

action('showtest', function() {
  for (var key in req.body)
  {
    send(key.toString());
    break;
  }
});

Express used to expose a .rawBody property on the request object, which would contain the raw data posted, but as of Express 3.x this functionality has been removed. The for loop in the above code will return the first key of the req.body object (which, when the data POST'ed is just a single number, will be that number).