lundi 23 novembre 2015

Difficulties with routes translation and api

I am creating an API for my project and I have the following problem:

I'm using the location files.

Route::group(array('prefix' => Config::get('app.locale_prefix')), function()
{

    Route::get('{contact}', 'WelcomeController@index'); 
});

This part of code works correctly, and I can access with

http://localhost/project/public/en

However, I am interested in create an API to receive a list of products. So I add this code:

Route::group(array('prefix' => Config::get('app.locale_prefix')), function()
{

    Route::get('{contact}', 'WelcomeController@index'); 
    Route::group(['prefix' => 'api'], function() {

    Route::get('test', function(){
        return response()->json(['foo'=>'bar']);
    });

    });

});

I don't have any errors , but I can't receive a response. What is the problem ?

http://localhost/project/public/en/api/test



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire