Map URL with Method in Tonic?

220 Views Asked by At

I want to map the URL with tonic, how can I do that? is there any particular doc where I can? except for its API doc, because I have read it's API there are no any docs about that?

for example here is my class

    /**
 * Display and process a HTML form via a HTTP POST request
 *
 * This page outputs a simple HTML form and gathers the POSTed data
 *
 *
 *
 *
 * @uri /example/getExample/:name     
 * @uri /example/getExample/         
 * 
 * @uri /Example/:name
 * 
 */
 class example extend Resource{

    /**
     *  
     * Handle a GET request for this resource
     * @method GET
     * @param Request $name
     * @return str
     */
    function getExamplemethod1($name=null) {
        return json_encode(array('status'=>'done method 2'));
    }

    /**
     * 
     * Handle a POST request for this resource
     * @method GET
     * @param Request $name
     * @return str
     */
    function getExamplemethod2($name=null) {
        if($name == null){
            return json_encode(array('status'=>'done1'));
        }
        else{
            return json_encode(array('status'=>'done1', 'name'=>$name));
        }
    }



 }

I want to call the method in the URL how can I do that?

0

There are 0 best solutions below