You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,7 @@ These are all the configuration options and their default value between brackets
80
80
- "tables": Comma separated list of tables to publish (defaults to 'all')
81
81
- "middlewares": List of middlewares to load (`cors`)
82
82
- "controllers": List of controllers to load (`records,geojson,openapi,status`)
83
+
- "customControllers": List of user custom controllers to load (no default)
83
84
- "openApiBase": OpenAPI info (`{"info":{"title":"PHP-CRUD-API","version":"1.0.0"}}`)
84
85
- "cacheType": `TempFile`, `Redis`, `Memcache`, `Memcached` or `NoCache` (`TempFile`)
85
86
- "cachePath": Path/address of the cache (defaults to system's temp directory)
@@ -1504,3 +1505,35 @@ Test the script (running in the container) by opening the following URL:
1504
1505
http://localhost:8080/records/posts/1
1505
1506
1506
1507
Enjoy!
1508
+
1509
+
## Custom Endpoints with Controller
1510
+
1511
+
You can add your own custom REST API endpoints by writing your own custom controller class. The class must provide a constructor that accepts three parameters. These parameters will allow you to register
1512
+
custom endpoints to the existing router and with a callback that implements your own logic.
1513
+
1514
+
Here is an example of custom controller class:
1515
+
1516
+
```
1517
+
class MyHelloController {
1518
+
public function __construct(Router $router, Responder $responder, RecordService $service)
0 commit comments