← Laravel tutorial

Laravel

Routes

Routes live in routes/web.php. Each one maps a URL pattern to a closure or a controller method.

Example: the simplest possible route

// routes/web.php
Route::get('/', function () {
    return 'Hello, world!';
});
Hello, world!

A route wrapping its logic directly in a closure like this is fine for something this small — but as logic grows past a line or two, it moves into a dedicated controller, covered next, so routes/web.php stays readable as a map of "what goes where" rather than growing into a file full of actual business logic.

Example
// routes/web.php
Route::get('/', function () {
    return 'Hello, world!';
});
Output
Hello, world!