From 794e8e7099d8be6d2c9fdc4d750d71fe89fe3dc4 Mon Sep 17 00:00:00 2001 From: Stephen Cochrane Date: Sun, 26 Feb 2023 23:52:33 +0200 Subject: [PATCH] Updated README --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 31fc1f9..e6eb007 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,28 @@ > Backend for cosmic +## Modules + +The core concept around the cosmic API is the module. At a high level, a Module +is a class that an abstract java project/program may implement, then this +project may be added to cosmics classpath, then at runtime cosmic will detect +And serve the module. + +A module is essentually a rest API entry point to some abstract java +application. To create a module, the application must do two things. + +Annotate the module with the [`@Module`](https://git.sr.ht/~skiqqy/libCosmic/tree/master/item/src/main/java/xyz/skiqqy/cosmic/lib/module/Module.java) annotation. This allows cosmic to detect +and load the module. The other is the module must extend and implement a +[`ModuleConf`](https://git.sr.ht/~skiqqy/libCosmic/tree/master/item/src/main/java/xyz/skiqqy/cosmic/lib/module/ModuleConf.java) class. This conf is then pass to the single constructor used +to instantiate the Module. + +The config should then be given to cosmic so that it may instantaite the module +at start up. + +I have left out alot of detail to try condense this, it is best to read the +source code directly to see how this happens (I will soon have a demo out +showing this in action). + ## Installing ``` -- 2.45.2