lundi 29 octobre 2018

API Routing Laravel 5.5

I have basic controller, where I want it to receive any json request. Am new to api routing. I get Sorry No Page Found When I use POST MAN. First I tested it on GET and made it call a simple return but throws the error."Sorry, the page you are looking for could not be found." I removed the api prefix in the RouteServiceProvider.php and to no success.I put my demo controller

Routing api.php

<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


Route::get('/test_api/v1', 'TestController@formCheck');

TestController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class TestController extends Controller
{
  public function formCheck(){
    return "YES !!!";
  }

  public function formPost(Request $request)
  {
    $formData = $request->all();
    return response()->json($formData, 201);

  }
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OYxZeG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire