title: Laravel 5.4 API not returning JSON in Postman
body: <p>I've Created a new Laravel 5.4 Project, Created the model ' Recipe ' , the migrations table ' recipes ' and added the routes to the ' Api.php ' . But when testing my API in Postman, instead of getting a Json Response i get a Html File.</p>
  
  <p>Here are the codes as per the below files:</p>
  
  <p>API.php Routes file</p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Http\Request;
  
  Route::post('/recipe', 'RecipeController@postRecipe')-
  &gt;name('get_recipe');
  Route::get('/recipe', 'RecipeController@getRecipe')-
  &gt;name('post_recipe');
  </code></pre>
  
  <p>RecipeController</p>
  
  <p>
  
  <pre><code>namespace App\Http\Controllers;
  
  
  use App\Recipe;
  use Illuminate\Http\Request;
  
  class RecipeController extends Controller {
  
  public function postRecipe(Request $request)
  {
      $recipe = new Recipe();
      $recipe-&gt;content = $request-&gt;input('content');
      $recipe-&gt;save();
      return response()-&gt;json(['recipe' =&gt; $recipe], 201);
  }
  
  public function getRecipe()
  {
      return response()-&gt;json(['message' =&gt; 'Got a Response'],200);
  }
  </code></pre>
  
  <p>Recipe Model</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Recipe extends Model
  {
  protected $fillable = ['content'];
  }
  </code></pre>
  
  <p>The migration was migrated and the table ' recipes '  created ' .</p>
  
  <p>Then in postman i try a ' get ' request to my url: ' recipeapi.dev/api/recipe ' but get html codes.</p>
  
  <p>The same happens when i try a ' post ' request to my url: ' recipeapi.dev/api/recipe ' . OFC for the post request i include headers: ' Content-Type ' ' application/json ' . Still getting the same html codes....</p>
  
  <p>Using Homestead/vagrant for laravel and if i use browser to go to default route: '/' it brings me to the welcome Laravel Page.</p>
  
  <p>Don't know whats the problem i keep getting these html codes and not Json Data as per my controller.</p>
  
  <p>Here are the pics of postman with the data....</p>
  
  <p><a href="https://i.stack.imgur.com/ngDac.jpg" rel="nofollow noreferrer">Get request with Postman</a></p>
  
  <p><a href="https://i.stack.imgur.com/mgtRm.png" rel="nofollow noreferrer">Post request with Postman</a></p>
  
  <p>Anyone got any idea what's going on? Why are my not getting Json data from my api from the get and post request?</p>
  
  <p>Thanks Guys!</p>