lambder 1.0.90 → 1.0.92

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.
Files changed (2) hide show
  1. package/Readme.md +28 -3
  2. package/package.json +1 -1
package/Readme.md CHANGED
@@ -108,9 +108,6 @@ lambder.addApi("getCompanyPage", async (ctx, res) => {
108
108
 
109
109
 
110
110
  ### Adding Routes
111
-
112
- For more details on route matching, please check [path-to-regexp](https://www.npmjs.com/package/path-to-regexp) package.
113
-
114
111
  ```typescript
115
112
  // Route with parameters
116
113
  lambder.addRoute("/user/:userId", async (ctx, res) => {
@@ -132,6 +129,34 @@ lambder.addHook("beforeRender", async (ctx, res) => {
132
129
  });
133
130
  ```
134
131
 
132
+
133
+ ### Add Module
134
+
135
+ ```typescript
136
+ lambder.addModule(async (lambder: Lambder): Promise<void> => {
137
+ // lambder.addHook(...)
138
+ // lambder.addRoute(...)
139
+ });
140
+ ```
141
+
142
+ ### Project Structure:
143
+
144
+ Add your imports to index.ts:
145
+ ```typescript
146
+ lambder.importModule(import("api.user.js"));
147
+ ```
148
+
149
+ User related functions can now be added to api.user.ts:
150
+ ```typescript
151
+ import type Lambder from "lambder";
152
+
153
+ export default (lambder: Lambder): void => {
154
+ // lambder.addApi(...)
155
+ // lambder.addApi(...)
156
+ };
157
+ ```
158
+
159
+
135
160
  ### Render Context (ctx) Variables
136
161
  ```typescript
137
162
  lambder.addApi("getCompanyName", async (ctx, res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambder",
3
- "version": "1.0.90",
3
+ "version": "1.0.92",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",