Skip to content

Commit 2daaad3

Browse files
committed
more DOCS
1 parent 0095619 commit 2daaad3

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

readme.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Here is a list of the packages installed:
2020
- [Eloquent Sluggable](https://github.com/cviebrock/eloquent-sluggable)
2121
- [Laravel UUID](https://github.com/webpatser/laravel-uuid)
2222

23-
## Instalation
23+
## Installation
2424

2525
To install the project you can use composer
2626

@@ -87,7 +87,7 @@ The available grants by default are:
8787
- Password Grant
8888
- Refresh Token Grant
8989

90-
First you will need to create a client in the `oauth_clients` table, you can refer tho the test [here](https://github.com/joselfonseca/laravel-api/blob/master/tests/Auth/OAuthServerTest.php#L71) for an example. Once you have a client you can send the request to authenticate using this grant to the endpoint `/api/oauth/authorize`
90+
First you will need to create a client in the `oauth_clients` table, you can refer to the test [here](https://github.com/joselfonseca/laravel-api/blob/master/tests/Auth/OAuthServerTest.php#L71) for an example. Once you have a client you can send the request to authenticate using this grant to the endpoint `/api/oauth/authorize`
9191

9292
```
9393
POST /api/oauth/authorize HTTP/1.1
@@ -142,16 +142,35 @@ if the credentials are incorrect it should return the appropriate 401 response
142142
}
143143
```
144144

145-
For more information please visit [The oAuth2 repository](https://github.com/lucadegasperi/oauth2-server-laravel/tree/master/docs)
145+
For more information please visit [The oAuth2 repository](https://github.com/lucadegasperi/oauth2-server-laravel/tree/master/docs)
146146

147-
## Dingo/Api
147+
## Routing
148148

149-
This started kit has already set up [dingo/api](https://github.com/dingo/api) to manage routes, requests, responses, protecting endpoint, versioning and much more, for more details please visit [https://github.com/dingo/api](https://github.com/dingo/api)
149+
We use Dingo/Api for routing, this means you have all the methods available [here](https://github.com/dingo/api/wiki/Creating-API-Endpoints)
150+
151+
### Example routes
152+
153+
```php
154+
$api = app('Dingo\Api\Routing\Router');
155+
$api->version('v1', function ($api) {
156+
$api->group(['prefix' => 'oauth'], function ($api) {
157+
$api->post('authorize', 'App\Http\Controllers\Auth\AuthController@authorizeClient');
158+
});
159+
// Protected routes
160+
$api->group(['middleware' => 'api.auth', 'namespace' => 'App\Http\Controllers'], function($api){
161+
// profile routes
162+
$api->get('me', 'Users\ProfileController@me');
163+
// users routes
164+
$api->resource('users', 'Users\UsersController');
165+
});
166+
}
167+
);
168+
```
150169

151170
## Tests
152171

153172
Navigate to the project root and run `vendor/bin/phpunit` after installing all the composer dependencies and after the .env file was created.
154173

155174
## License
156175

157-
The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
176+
The Laravel API Starter kit is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)