RESTful js function example