dimanche 29 mai 2016

JSON endpoints alongside regular actions in controllers

I have a QuizzesController which implements all of the standard restful actions: create, store, edit, etc. And I also have additional presentQuestion and answerQuestion:

public function presentQuestion 
{
    // . . .
    return response()->json($question);
}

public function answerQuestion($quiz_id)
{
    // . . .        
    $this->handleAnsweredQuestion($question_id);
}

Is it a good practice to mix the JSON endpoints with regular php actions in controllers, or can this design cause any unexpected problems in the future?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire