Recall & Review
beginner
What is a route in Laravel?
A route in Laravel is a way to define how the application responds to a specific URL or HTTP request method like GET or POST.
Click to reveal answer
beginner
How do you define a simple GET route in Laravel?
Use the Route::get method with the URL path and a callback function. Example: Route::get('/home', function () { return 'Hello'; });
Click to reveal answer
beginner
What does the callback function in a Laravel route do?
It contains the code that runs when the route URL is visited. Usually, it returns a view or some response.
Click to reveal answer
beginner
Can Laravel routes respond to different HTTP methods?
Yes, Laravel routes can respond to methods like GET, POST, PUT, DELETE using Route::get, Route::post, Route::put, Route::delete respectively.
Click to reveal answer
beginner
Where do you usually define routes in a Laravel project?
Routes are usually defined in the routes/web.php file for web routes and routes/api.php for API routes.
Click to reveal answer
Which method defines a route that responds to a GET request in Laravel?
✗ Incorrect
Route::get() defines a route that listens for GET requests.
Where do you define web routes in a Laravel project?
✗ Incorrect
Web routes are defined in routes/web.php by default.
What does this route do? Route::get('/hello', function () { return 'Hi'; });
✗ Incorrect
It responds to a GET request at /hello by returning 'Hi'.
Which HTTP method is NOT directly supported by Laravel route methods?
✗ Incorrect
Laravel does not have a direct Route::connect() method.
What is the purpose of the callback function in a Laravel route?
✗ Incorrect
The callback defines what happens when the route URL is visited.
Explain how to create a basic GET route in Laravel and what happens when it is accessed.
Think about how you tell Laravel what to do when someone visits a URL.
You got /4 concepts.
Describe where Laravel routes are stored and why separating web and API routes is useful.
Consider how different types of routes serve different parts of an app.
You got /4 concepts.