Get the format from the Accept header.
Eg : curl -i -H "Accept:application/json"  http://localhost:8000/greet

The action in the case will be like

namespace Example\Package\Web\Greet;

use Aura\Framework\Web\Controller\AbstractPage;

class Page extends AbstractPage
{
    public function actionIndex()
    {
        $this->data->message = $this->context->getQuery('name', 'guys!');
        // multiple views
        $this->view = [
            '.html' => 'index',
            '.json' => 'greet.json.php',
        ];
        $this->layout = [
            '.html' => 'default',
            '.json' => '',
        ];
    }
}

// config/default.php
$di->get('router_map')->add('example_package_greet', '/greet', [
    'values' => [
    'controller' => 'greet',
        'action' => 'index',
    ],
]);

See we have not used any formats here.

In the view index.php will be normal html, where as `greet.json.php`
will be json_encode($this->data);

I am interested to hear your thoughts on this.

Thanks
Merge pull request #44 from harikt/rest-support

Get the format from the Accept header.