@hono/node-server
Advanced tools
Comparing version 1.8.2 to 1.9.0
@@ -286,2 +286,5 @@ "use strict"; | ||
// src/utils/response/constants.ts | ||
var X_ALREADY_SENT = "x-hono-already-sent"; | ||
// src/globals.ts | ||
@@ -386,2 +389,3 @@ var import_node_crypto = __toESM(require("crypto")); | ||
} | ||
} else if (resHeaderRecord[X_ALREADY_SENT]) { | ||
} else { | ||
@@ -388,0 +392,0 @@ outgoing.writeHead(res.status, resHeaderRecord); |
@@ -281,2 +281,5 @@ "use strict"; | ||
// src/utils/response/constants.ts | ||
var X_ALREADY_SENT = "x-hono-already-sent"; | ||
// src/globals.ts | ||
@@ -381,2 +384,3 @@ var import_node_crypto = __toESM(require("crypto")); | ||
} | ||
} else if (resHeaderRecord[X_ALREADY_SENT]) { | ||
} else { | ||
@@ -383,0 +387,0 @@ outgoing.writeHead(res.status, resHeaderRecord); |
@@ -283,2 +283,5 @@ "use strict"; | ||
// src/utils/response/constants.ts | ||
var X_ALREADY_SENT = "x-hono-already-sent"; | ||
// src/globals.ts | ||
@@ -383,2 +386,3 @@ var import_node_crypto = __toESM(require("crypto")); | ||
} | ||
} else if (resHeaderRecord[X_ALREADY_SENT]) { | ||
} else { | ||
@@ -385,0 +389,0 @@ outgoing.writeHead(res.status, resHeaderRecord); |
@@ -281,2 +281,5 @@ "use strict"; | ||
// src/utils/response/constants.ts | ||
var X_ALREADY_SENT = "x-hono-already-sent"; | ||
// src/globals.ts | ||
@@ -381,2 +384,3 @@ var import_node_crypto = __toESM(require("crypto")); | ||
} | ||
} else if (resHeaderRecord[X_ALREADY_SENT]) { | ||
} else { | ||
@@ -383,0 +387,0 @@ outgoing.writeHead(res.status, resHeaderRecord); |
{ | ||
"name": "@hono/node-server", | ||
"version": "1.8.2", | ||
"version": "1.9.0", | ||
"description": "Node.js Adapter for Hono", | ||
@@ -25,2 +25,7 @@ "main": "dist/index.js", | ||
"import": "./dist/vercel.mjs" | ||
}, | ||
"./utils/*": { | ||
"types": "./dist/utils/*.d.ts", | ||
"require": "./dist/utils/*.js", | ||
"import": "./dist/utils/*.mjs" | ||
} | ||
@@ -38,2 +43,5 @@ }, | ||
"./dist/vercel.d.ts" | ||
], | ||
"utils/*": [ | ||
"./dist/utils/*.d.ts" | ||
] | ||
@@ -40,0 +48,0 @@ } |
@@ -215,2 +215,29 @@ # Node.js Adapter for Hono | ||
## Direct response from Node.js API | ||
You can directly respond to the client from the Node.js API. | ||
In that case, the response from Hono should be ignored, so return `RESPONSE_ALREADY_SENT`. | ||
> [!NOTE] | ||
> This feature can be used when migrating existing Node.js applications to Hono, but we recommend using Hono's API for new applications. | ||
```ts | ||
import { serve } from '@hono/node-server' | ||
import type { HttpBindings } from '@hono/node-server' | ||
import { RESPONSE_ALREADY_SENT } from '@hono/node-server/utils/response' | ||
import { Hono } from 'hono' | ||
const app = new Hono<{ Bindings: HttpBindings }>() | ||
app.get('/', (c) => { | ||
const { outgoing } = c.env | ||
outgoing.writeHead(200, { 'Content-Type': 'text/plain' }) | ||
outgoing.end('Hello World\n') | ||
return RESPONSE_ALREADY_SENT | ||
}) | ||
serve(app) | ||
``` | ||
## Related projects | ||
@@ -217,0 +244,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148566
50
4557
254