Laravel Hello World Example (Basic)


Example

Open routes file. Paste the following code in:

Route::get('helloworld', function () {
    return '<h1>Hello World</h1>';
});

after going to route localhost/helloworld it displays Hello World.

The routes file is located:

5.3

For Web

routes/web.php

For APIs

routes/api.php
5.25.1 (LTS)5.0
app/Http/routes.php
4.2
app/routes.php