fluxion-ts 0.1.3 → 0.1.5

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
@@ -22,7 +22,7 @@ Fluxion is a filesystem-routing dynamic server for Node.js.
22
22
  ## Install
23
23
 
24
24
  ```bash
25
- npm install fluxion
25
+ pnpm add fluxion
26
26
  ```
27
27
 
28
28
  ## Quick Start
@@ -42,12 +42,16 @@ fluxion({
42
42
  Create `dynamicDirectory/hello.ts`:
43
43
 
44
44
  ```ts
45
- export default async function handler(req) {
45
+ import { defineFluxionHandler } from 'fluxion';
46
+
47
+ // defineFluxionHandler is only for better type inference and editor support.
48
+ // You can export the handler function directly without it.
49
+ export default defineFluxionHandler(async function handler(req) {
46
50
  return {
47
51
  message: 'hello fluxion',
48
52
  path: req.url.pathname,
49
53
  };
50
- }
54
+ })
51
55
  ```
52
56
 
53
57
  Run:
package/dist/index.d.ts CHANGED
@@ -192,7 +192,7 @@ type FluxionHandler<
192
192
  request: NormalizedRequest,
193
193
  rawRequest: InstanceType<Request>,
194
194
  rawResponse: InstanceType<Response> & { req: InstanceType<Request> },
195
- ) => Promise<unknown>;
195
+ ) => Promise<unknown> | unknown;
196
196
 
197
197
  declare function fluxion(options: FluxionOptions): Promise<void>;
198
198