0
votes

I have my laravel project created inside laragon/www folder and I'm using dingo/api package for routing.

Here are my files

routes/web.php

<?php
Route::get('/', function () {
    return view('welcome');
});

routes/api.php

<?php
use Dingo\Api\Routing\Router;
$api->get('test', 'TestController@index');

app/Http/Controllers/Api/TestController.php

<?php
namespace App\Http\Controllers\Api;
class TestController extends BaseController {
    public function index() {
        return 'test';
    }
}

When I run artisan api/routes it gives me the URI api/test but when I try to reach it in my browser under http://localhost/myproject/public/api/test it returns error "Sorry, the page you are looking for could not be found" knowing that http://localhost/myproject/public/ returns the good result

1

1 Answers

0
votes

try

<?php
$api = app('Dingo\Api\Routing\Router');
$api->get('test', 'TestController@index');