lambder 1.0.90 → 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 +28 -0
- package/package.json +1 -1
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) => {
|