lambder 1.0.89 → 1.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -132,6 +132,34 @@ lambder.addHook("beforeRender", async (ctx, res) => {
132
132
  });
133
133
  ```
134
134
 
135
+
136
+ ### Add Module
137
+
138
+ ```typescript
139
+ lambder.addModule(async (lambder: Lambder): Promise<void> => {
140
+ // lambder.addHook(...)
141
+ // lambder.addRoute(...)
142
+ });
143
+ ```
144
+
145
+ ### Project Structure:
146
+
147
+ Add your imports to index.ts:
148
+ ```typescript
149
+ lambder.importModule(import("api.user.js"));
150
+ ```
151
+
152
+ User related functions can now be added to api.user.ts:
153
+ ```typescript
154
+ import type Lambder from "lambder";
155
+
156
+ export default (lambder: Lambder): void => {
157
+ // lambder.addApi(...)
158
+ // lambder.addApi(...)
159
+ };
160
+ ```
161
+
162
+
135
163
  ### Render Context (ctx) Variables
136
164
  ```typescript
137
165
  lambder.addApi("getCompanyName", async (ctx, res) => {
package/dist/Lambder.d.ts CHANGED
@@ -60,7 +60,7 @@ export default class Lambder {
60
60
  private validateSession;
61
61
  private handleNoMatchedAction;
62
62
  addModule(moduleFn: LambderModuleFunction): Promise<void>;
63
- addModuleImport(moduleImport: Promise<{
63
+ importModule(moduleImport: Promise<{
64
64
  default: LambderModuleFunction;
65
65
  }>): Promise<void>;
66
66
  addRoute(condition: Path | ConditionFunction | RegExp, actionFn: ActionFunction): void;
package/dist/Lambder.js CHANGED
@@ -114,7 +114,7 @@ export default class Lambder {
114
114
  async addModule(moduleFn) {
115
115
  await moduleFn(this);
116
116
  }
117
- async addModuleImport(moduleImport) {
117
+ async importModule(moduleImport) {
118
118
  await (await moduleImport).default(this);
119
119
  }
120
120
  addRoute(condition, actionFn) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambder",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/Lambder.ts CHANGED
@@ -165,7 +165,7 @@ export default class Lambder {
165
165
  await moduleFn(this);
166
166
  }
167
167
 
168
- async addModuleImport(moduleImport: Promise<{ default: LambderModuleFunction }>): Promise<void>{
168
+ async importModule(moduleImport: Promise<{ default: LambderModuleFunction }>): Promise<void>{
169
169
  await (await moduleImport).default(this);
170
170
  }
171
171