From: Philipp Holzer Date: Wed, 1 May 2019 17:58:51 +0000 (+0200) Subject: Update README for Modules X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b3cee63745572e689490d221f8eb80438b87373b;p=friendica.git Update README for Modules --- diff --git a/src/Module/README.md b/src/Module/README.md index 66a4967f33..a2f2b9de56 100644 --- a/src/Module/README.md +++ b/src/Module/README.md @@ -16,10 +16,16 @@ A frontend module should extend the [`BaseModule`](https://github.com/friendica/ ### Backend modules -This type of modules mainly responds either with `XML` or with `JSON`. +This type of modules mainly responds either with encoded `XML` or with `JSON` output. +It isn't intended to respond with human readable text. -Rules for Modules: -- Named like the call (i.e. https://friendica.test/contact => `Contact`) -- Start with capitals and are **not** camelCased. -- Directly interacting with a given request (POST or GET) -- Extending [`BaseModule`](https://github.com/friendica/friendica/blob/develop/src/BaseModule.php). \ No newline at end of file +A frontend module should extend the [`BaseModule`](https://github.com/friendica/friendica/blob/develop/src/BaseModule.php), especially the `rawContent()` method. + +### Routing + +Every module needs to be accessed within a route. +The routing mechanism is using a PSR-7 based routing and the routes are defined inside [`Router->collectRoutes()`](https://github.com/friendica/friendica/blob/develop/src/App/Router.php). + +Use the given routes as a pattern for further routes. + +The routing library can be found [here](https://github.com/thephpleague/route). \ No newline at end of file