lambder 1.0.84 → 1.0.85

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 +14 -15
  2. package/package.json +1 -1
package/Readme.md CHANGED
@@ -153,55 +153,54 @@ lambder.addApi("getCompanyName", async (ctx, res) => {
153
153
 
154
154
  ```typescript
155
155
  lambder.addApi("getCompanyName", async (ctx, res) => {
156
- res.raw(param);
157
- // Directly sends a custom HTTP response defined by the param object.
156
+ return res.raw(param);
157
+ // Sends a custom HTTP response defined by the param object.
158
158
  // Useful for sending non-standard responses.
159
- res.json(data, headers);
159
+ return res.json(data, headers);
160
160
  // Sends a JSON response with the specified data and optional headers.
161
161
  // It sets the Content-Type header to application/json.
162
162
 
163
- res.xml(data);
163
+ return res.xml(data);
164
164
  // Sends an XML response with the given data.
165
165
  // Automatically encodes the response in base64 and sets
166
166
  // the Content-Type header to application/xml.
167
167
 
168
- res.html(data, headers);
168
+ return res.html(data, headers);
169
169
  // Sends an HTML response containing the provided data with optional headers.
170
170
  // The response is base64 encoded, and the Content-Type header is set to text/html.
171
171
 
172
- res.status301(url, headers);
172
+ return res.status301(url, headers);
173
173
  // Redirects the client to the specified url with a 301 status code and optional headers.
174
174
  // Useful for permanent redirections.
175
175
 
176
- res.status404(data, headers);
176
+ return res.status404(data, headers);
177
177
  // Sends a 404 Not Found response with custom data and optional headers.
178
178
  // The response is base64 encoded, and the Content-Type header is set to text/html.
179
179
 
180
- res.cors();
180
+ return res.cors();
181
181
  // Sends a 200 OK response with CORS headers enabled.
182
182
  // This is typically used in response to a preflight request in a CORS scenario.
183
183
 
184
- res.fileBase64(fileBase64, mimeType, headers);
184
+ return res.fileBase64(fileBase64, mimeType, headers);
185
185
  // Sends a file response with the content provided in base64 format,
186
186
  // the specified mimeType, and optional headers.
187
187
 
188
- res.file(filePath, headers, fallbackFilePath);
188
+ return res.file(filePath, headers, fallbackFilePath);
189
189
  // Serves a file from the server's public directory, with optional headers.
190
190
  // If the file is not found and a fallbackFilePath is provided,
191
191
  // attempts to serve the fallback file.
192
192
  // Returns a JSON error if neither file is found.
193
193
 
194
- res.api({ payload, versionExpired, sessionExpired, notAuthorized, message, errorMessage }, headers);
194
+ return res.api({ payload, versionExpired, sessionExpired, notAuthorized, message, errorMessage }, headers);
195
195
  // Sends a standardized API response including the payload and status
196
196
  // flags like versionExpired, sessionExpired, notAuthorized, along with
197
197
  // optional messages and headers.
198
198
 
199
199
  // res.die.*
200
200
  // Acts the same as res.* but will:
201
- // - Immediately return the value
202
- // - Terminate the function
203
- // - Skip the afterRender hooks
204
-
201
+ // - Immediately return the value.
202
+ // - Skip the afterRender hooks.
203
+
205
204
  res.die.raw(param);
206
205
  res.die.json(data, headers);
207
206
  res.die.xml(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambder",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",