From b3cee63745572e689490d221f8eb80438b87373b Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Wed, 1 May 2019 19:58:51 +0200 Subject: [PATCH] Update README for Modules --- src/Module/README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Module/README.md b/src/Module/README.md index 66a4967f3..a2f2b9de5 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