@hono/node-server 1.3.5 → 1.4.0
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 +16 -0
- package/dist/serve-static.d.mts +2 -1
- package/dist/serve-static.d.ts +2 -1
- package/dist/serve-static.js +1 -0
- package/dist/serve-static.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -162,6 +162,22 @@ app.use(
|
|
|
162
162
|
)
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
#### `onNotFound`
|
|
166
|
+
|
|
167
|
+
The `onNotFound` is useful for debugging. You can write a handle for when a file is not found.
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
app.use(
|
|
171
|
+
'/static/*',
|
|
172
|
+
serveStatic({
|
|
173
|
+
root: './non-existent-dir',
|
|
174
|
+
onNotFound: (path, c) => {
|
|
175
|
+
console.log(`${path} is not found, request to ${c.req.path}`)
|
|
176
|
+
},
|
|
177
|
+
})
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
165
181
|
## Related projects
|
|
166
182
|
|
|
167
183
|
- Hono - <https://hono.dev>
|
package/dist/serve-static.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MiddlewareHandler } from 'hono';
|
|
1
|
+
import { Context, MiddlewareHandler } from 'hono';
|
|
2
2
|
|
|
3
3
|
type ServeStaticOptions = {
|
|
4
4
|
/**
|
|
@@ -8,6 +8,7 @@ type ServeStaticOptions = {
|
|
|
8
8
|
path?: string;
|
|
9
9
|
index?: string;
|
|
10
10
|
rewriteRequestPath?: (path: string) => string;
|
|
11
|
+
onNotFound?: (path: string, c: Context) => void | Promise<void>;
|
|
11
12
|
};
|
|
12
13
|
declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler;
|
|
13
14
|
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MiddlewareHandler } from 'hono';
|
|
1
|
+
import { Context, MiddlewareHandler } from 'hono';
|
|
2
2
|
|
|
3
3
|
type ServeStaticOptions = {
|
|
4
4
|
/**
|
|
@@ -8,6 +8,7 @@ type ServeStaticOptions = {
|
|
|
8
8
|
path?: string;
|
|
9
9
|
index?: string;
|
|
10
10
|
rewriteRequestPath?: (path: string) => string;
|
|
11
|
+
onNotFound?: (path: string, c: Context) => void | Promise<void>;
|
|
11
12
|
};
|
|
12
13
|
declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler;
|
|
13
14
|
|
package/dist/serve-static.js
CHANGED
package/dist/serve-static.mjs
CHANGED