mirror of https://github.com/vapor/docs.git
Resource table finished
This commit is contained in:
parent
739cb89630
commit
aa4d71d879
|
|
@ -47,7 +47,28 @@ This single route declaration creates multiple routes to handle a variety of act
|
|||
The generated controller will already have methods stubbed for each of these actions, including
|
||||
notes informing you of the HTTP verbs and URIs they handle.
|
||||
|
||||
| Verb | URI | Action|
|
||||
| ------------- |:-------------:| -----:|
|
||||
| Verb | URI | Action |
|
||||
| :-------------: | :-------------: | :-----------: |
|
||||
| GET | test/index | test.index |
|
||||
| POST | test/create | test.create |
|
||||
| GET | test/show | test.show |
|
||||
| PUT | test/replace | test.replace |
|
||||
| PATCH | test/destroy | test.destroy |
|
||||
| DELETE | test/destroy | test.destroy |
|
||||
| DELETE | test/clear | test.clear |
|
||||
|
||||
You can also custom method name, add `makeResource` method in the controller
|
||||
|
||||
```swift
|
||||
func makeResource() -> Resource<First> {
|
||||
return Resource(
|
||||
index: index,
|
||||
store: create,
|
||||
show: show,
|
||||
replace: replace,
|
||||
modify: update,
|
||||
destroy: delete,
|
||||
clear: clear
|
||||
)
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue