Skip to content

Commit 020b916

Browse files
authored
Merge pull request #377 from karthik2804/update_hono_templates
update hono templates to addres deprecation
2 parents 398a85c + 098259d commit 020b916

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

templates/http-js/content/src/index.js.tmpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{%- case http-router -%}
2-
{% when "hono" %}
3-
// For Hono documentation refer to https://hono.dev/docs/
2+
{% when "hono" %}// For Hono documentation refer to https://hono.dev/docs/
43
import { Hono } from 'hono';
4+
import { fire } from 'hono/service-worker';
55
import { logger } from 'hono/logger';
66

77
let app = new Hono();
88

99
// Logging to stdout via built-in middleware
10-
app.use(logger())
10+
app.use(logger());
1111

1212
// Example of a custom middleware to set HTTP response header
1313
app.use(async (c, next) => {
14-
c.header('server', 'Spin CLI')
14+
c.header('server', 'Spin CLI');
1515
await next();
1616
})
1717

1818
app.get('/', (c) => c.text('Hello, Spin!'));
1919
app.get('/hello/:name', (c) => {
20-
return c.json({ message: `Hello, ${c.req.param('name')}` })
20+
return c.json({ message: `Hello, ${c.req.param('name')}` });
2121
});
2222

23-
app.fire();
23+
fire(app);
2424
{% when "itty" %}
2525
// For AutoRouter documentation refer to https://itty.dev/itty-router/routers/autorouter
2626
import { AutoRouter } from 'itty-router';
@@ -44,7 +44,7 @@ function handle(_request) {
4444
headers: {
4545
'content-type': 'text/plain'
4646
}
47-
})
47+
});
4848
}
4949

5050
addEventListener('fetch', (event) => {

templates/http-ts/content/src/index.ts.tmpl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
{%- case http-router -%}
2-
{% when "hono" %}
3-
// For Hono documentation refer to https://hono.dev/docs/
2+
{% when "hono" %}// For Hono documentation refer to https://hono.dev/docs/
43
import { Hono } from 'hono';
5-
import type { Context, Next } from 'hono'
4+
import { fire } from 'hono/service-worker';
5+
import type { Context, Next } from 'hono';
66
import { logger } from 'hono/logger';
77

88
let app = new Hono();
99

1010
// Logging to stdout via built-in middleware
11-
app.use(logger())
11+
app.use(logger());
1212

1313
// Example of a custom middleware to set HTTP response header
1414
app.use(async (c: Context, next: Next) => {
15-
c.header('server', 'Spin CLI')
15+
c.header('server', 'Spin CLI');
1616
await next();
1717
})
1818

1919
app.get('/', (c: Context) => c.text('Hello, Spin!'));
2020
app.get('/hello/:name', (c: Context) => {
21-
return c.json({ message: `Hello, ${c.req.param('name')}!` })
21+
return c.json({ message: `Hello, ${c.req.param('name')}!` });
2222
});
2323

24-
app.fire();
24+
fire(app);
2525
{% when "itty" %}
2626
// For AutoRouter documentation refer to https://itty.dev/itty-router/routers/autorouter
2727
import { AutoRouter } from 'itty-router';
@@ -46,7 +46,7 @@ function handle(_request: Request): Response {
4646
headers: {
4747
'content-type': 'text/plain'
4848
}
49-
})
49+
});
5050
}
5151

5252
//@ts-ignore

0 commit comments

Comments
 (0)