Added shared fodler documentation
@@ -6,6 +6,9 @@ V2 modules represent the modern approach to building Getiyo modules, offering si
|
||||
Module Root
|
||||
├── .dist Ouput folder for buid.
|
||||
├── .gmt Internal files used for api definitions.
|
||||
├── shared Shared TypeScript function and type definitions between server and pages.
|
||||
│ ├── **/*.ts
|
||||
│ └── **/*.d.ts
|
||||
├── server
|
||||
│ ├── src Folder containing all server TypeScript files.
|
||||
│ │ └── **/*.ts
|
||||
@@ -73,6 +76,10 @@ A control page is a specialized module page accessible only to moderators or adm
|
||||
|
||||
An external page is a unique module page without Getiyo UI elements that can be accessed by anyone with the URL. Unlike user and control pages, external pages are not scaled or queued. The file structure for an external page is the same as that of a user page.
|
||||
|
||||
## Shared Files
|
||||
|
||||
The shared directory is a key component of the V2 module architecture, designed to promote code reuse between server-side and client-side components. You can add .ts and .d.ts files to this directory to define functions, interfaces, types, and constants that need to be accessible across your module's ecosystem. By exporting these shared elements, you ensure consistent type definitions and behavior between your server implementation and various pages (user, control, and external). This approach eliminates duplication, reduces the risk of inconsistencies, and improves maintainability. For example, you might define API response types, validation functions, or configuration constants in the shared directory, making them available to both server-side processing logic and client-side rendering components. The TypeScript compiler will ensure these shared definitions remain in sync across all parts of your module.
|
||||
|
||||
## Static Files
|
||||
|
||||
You can include static files in a module build for later use with the [ModuleServerAPI](./ModuleServerAPI). To do so, create a `static` directory at the root of the module environment and place the files inside. Then you can use these files on the server side or make them available to client through [api.addHost()](./ModuleServerAPI#addhost).
|
||||
|
||||
Reference in New Issue
Block a user