File tree Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 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/
43import { Hono } from 'hono';
5- import { fire } from "hono/service-worker"
4+ import { fire } from "hono/service-worker";
65import { logger } from 'hono/logger';
76
87let app = new Hono();
98
109// Logging to stdout via built-in middleware
11- app.use(logger())
10+ app.use(logger());
1211
1312// Example of a custom middleware to set HTTP response header
1413app.use(async (c, next) => {
15- c.header('server', 'Spin CLI')
14+ c.header('server', 'Spin CLI');
1615 await next();
1716})
1817
1918app.get('/', (c) => c.text('Hello, Spin!'));
2019app.get('/hello/:name', (c) => {
21- return c.json({ message: `Hello, ${c.req.param('name')}` })
20+ return c.json({ message: `Hello, ${c.req.param('name')}` });
2221});
2322
2423fire(app);
@@ -45,7 +44,7 @@ function handle(_request) {
4544 headers: {
4645 'content-type': 'text/plain'
4746 }
48- })
47+ });
4948}
5049
5150addEventListener('fetch', (event) => {
Original file line number Diff line number Diff line change 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/
43import { Hono } from 'hono';
5- import { fire } from "hono/service-worker"
6- import type { Context, Next } from 'hono'
4+ import { fire } from "hono/service-worker";
5+ import type { Context, Next } from 'hono';
76import { logger } from 'hono/logger';
87
98let app = new Hono();
109
1110// Logging to stdout via built-in middleware
12- app.use(logger())
11+ app.use(logger());
1312
1413// Example of a custom middleware to set HTTP response header
1514app.use(async (c: Context, next: Next) => {
16- c.header('server', 'Spin CLI')
15+ c.header('server', 'Spin CLI');
1716 await next();
1817})
1918
2019app.get('/', (c: Context) => c.text('Hello, Spin!'));
2120app.get('/hello/:name', (c: Context) => {
22- return c.json({ message: `Hello, ${c.req.param('name')}!` })
21+ return c.json({ message: `Hello, ${c.req.param('name')}!` });
2322});
2423
2524fire(app);
@@ -47,7 +46,7 @@ function handle(_request: Request): Response {
4746 headers: {
4847 'content-type': 'text/plain'
4948 }
50- })
49+ });
5150}
5251
5352//@ts-ignore
You can’t perform that action at this time.
0 commit comments