Skip to content

Commit

Permalink
Updated composer.json configuration and modified README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleon4 committed Mar 25, 2022
1 parent 13fa553 commit b80b229
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Route::init([
'Dispatcher' => Phroute\Phroute\Dispatcher::class
],
'middleware' => [
Route::newMiddleware('auth', Auth::class, 'auth')
Route::newMiddleware('auth', Auth::class, 'auth'),
Route::newMiddleware('no-auth', Auth::class, 'auth')
]
]);

Expand All @@ -101,6 +102,37 @@ Route::prefix('authenticate', function() {
});
```

```php
Route::middleware(['before' => 'no-auth'], function() {
Route::prefix('authenticate', function() {
Route::post('login', function() {
return [
'status' => "success",
'message' => "Hello world."
];
});
});
});

Route::middleware(['before' => 'auth'], function() {
Route::prefix('dashboard', function() {
Route::get('home', function() {
return [
'status' => "success",
'message' => "GET success."
];
});

Route::post('home', function() {
return [
'status' => "success",
'message' => "POST success."
];
});
});
});
```

### Example methods:
#### POST
```php
Expand Down
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
}
],
"require": {
"php": ">=8.0.9"
},
"require-dev": {
"php": ">=8.0.9",
"phroute/phroute": "^2.1"
}
}
6 changes: 3 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b80b229

Please sign in to comment.