I'm working on a project using laravel 10 that uses REST API but I'm getting a 404 not found
error when I tried to test the url http://localhost/api/v1/continent
with GET request in Postman.
this is my routes/api.php
:
Route::prefix('v1')->name('v1.')->group(function() { Route::get('continent', function() { return 'get all continents'; });});
this is the code in my App/Http/Controllers/Api/V1/ContinentController.php
:
<?phpnamespace App\Http\Controllers\Api\V1;use App\Models\Continent;use Illuminate\Http\Request;use App\Http\Controllers\Controller;class ContinentController extends Controller{ /** * Display a listing of the resource. */ public function index() { $list = Continent::all(); // dd($list); return response()->json($list); }}
what am I doing wrong? any help is appreciated.