From 0a5a3930d9e54c8d8addc17774cf0b246179ccd8 Mon Sep 17 00:00:00 2001 From: Vladyslav Karpenko Date: Sat, 9 Dec 2023 22:37:52 +0200 Subject: [PATCH] Extend domain logic section in LAYERS with usage example --- content/en/LAYERS.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/en/LAYERS.md b/content/en/LAYERS.md index 57dbaf9..29d77b9 100644 --- a/content/en/LAYERS.md +++ b/content/en/LAYERS.md @@ -220,6 +220,15 @@ There is a special place for domain logic and application state: `application/do }); ``` +The methods and public properties of the module will be available from another application layers through the `domain.chat` namespace. For example it made possible a thin API endpoint `application/api/chat/send.js` that will deliver a message from one chat room participant to all others without handling a state by itself: + +```js +(async ({ room, message }) => { + domain.chat.send(room, message); + return true; +}); +``` + ## Libraries Auxiliary code that is not related to subject domain, but we don't want to create or import separate dependencies for it, can be placed in: `application/lib`. For example: