MWZ

MINDWAREZONE

beginnerLaravel

What is routing in Laravel?

Answer

Clear, interview-ready explanation

Routing maps an incoming HTTP request, identified by its method and URI, to code that should handle it. In Laravel, a route can point to a closure or to a controller action and may define middleware, names, parameters, and other behavior.

For example, Route::get('/posts', [PostController::class, 'index']) registers a handler for a GET request. Routes are commonly defined in the routes directory, keeping the URL structure and request entry points explicit rather than scattering them through the application.