Skip to content

Commit 5496c18

Browse files
committed
fix
1 parent 5e24c97 commit 5496c18

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ Libraries:
4343
- [preact-router]()
4444

4545
If you need to host built assets with path rewriting,
46-
I recommend `hono-worker` variant,
46+
check `hono-worker` variant,
4747
or [serve-handler](https://github.com/vercel/serve-handler) ([example](https://github.com/jokester/limb/blob/master/server/main.ts)).
4848

49-
### `hono-worker`, for edge-worker like environments
49+
### `hono`, for node.js or edge servers
5050

5151
- based on [hono](https://github.com/honojs/hono)
5252
- Capable of hosting SPA created by `preact-spa`
@@ -84,6 +84,4 @@ The principles behind current (opinionated) settings are:
8484

8585
## LICENSE
8686

87-
- work from upstream repositories follows their licenses
88-
- other contents are MIT licensed
89-
- other contents are WTFPL licensed too
87+
- MIT

hono/src/node-server.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
import { Hono } from 'hono';
2-
import { serve } from '@hono/node-server'
3-
import debug from 'debug'
2+
import { serve } from '@hono/node-server';
3+
import debug from 'debug';
44

55
debug.inspectOpts!.depth = 100;
6-
const logger = debug('node-server')
6+
const logger = debug('node-server');
77

88
const app = new Hono();
99
app.all('*', async (c) => {
10-
const reqUrl = c.req.raw.url
11-
const headers = c.req.header()
12-
const reqBody = await c.req.json().catch(e => 'not json')
13-
logger({ reqUrl, headers, reqBody })
14-
return c.text("It works!")
15-
})
10+
const reqUrl = c.req.raw.url;
11+
const headers = c.req.header();
12+
const reqBody = await c.req.json().catch(e => 'not json');
13+
logger({reqUrl, headers, reqBody});
14+
return c.text('It works!');
15+
});
1616
const server = serve(app, (info) => {
17-
console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000
18-
})
19-
20-
21-
17+
console.log(`Listening on http://localhost:${info.port}`); // Listening on http://localhost:3000
18+
});

hono/wrangler.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name = "hono-worker"
2-
compatibility_date = "2023-01-01"
1+
name = "hono-in-worker"
2+
compatibility_date = "2024-11-01"
33

44
main = "./src/app.ts"
55

scripts/smoking-test-exported.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cd $(dirname "$0")/..
66

77
rm -rf package.json package-lock.json node_modules */node_modules
88

9-
for d in empty next preact-spa hono-worker; do
9+
for d in empty next preact-spa hono; do
1010
tar xf $d.tar.xz
1111
pushd $d
1212
npm i

0 commit comments

Comments
 (0)