title: yii2 creating custom based Rest API
body: <p>I am creating my own custom based action for some calculation, which has to be send by restful api in json. The problem is when i create the controller inherited from activecontroller, then for the index action it asks a model class.</p>
  
  <p>I must need to use index action with my own custom based calculation which does not need to be store in the database so i actually do not need to create model class at all. This is first time i am using activecontroller so i am not sure how to make the index page act as according to my needs.</p>
  
  <p>I am able to create my own custom based action with any name i want  e.g. </p>
  
  <pre><code> public function actionFast()
      {
          echo "XXX";
      }
  </code></pre>
  
  <p>and inside the config/ web.php </p>
  
  <pre><code>'urlManager' =&gt; [
              'showScriptName' =&gt; false,
              'enablePrettyUrl' =&gt; true
              ,
              'rules' =&gt; [
                  ['class' =&gt; 'yii\rest\UrlRule', 'controller' =&gt; ['Apprest/Fast'], 'extraPatterns' =&gt; ['GET dast' =&gt; 'fast']],
              ],
          ],
  </code></pre>
  
  <p>but instead of my custom "Fast" action i need to use index action for all kinds of calculations. Is there a way to do that?</p>
  
  <p>Secondly i want to make this url restricted for GET only url , is there a way to make send the user to 404 error incase he tries to post on this page?</p>