/Knowledge/sources/honojs__hono/llms-full/service-worker-hello-world--part-02--3ecb8d14128c.md

Service Worker: Hello World (part 02) - hono-docs

Service Worker: Hello World (part 02) Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt 2 hello world Su...

Service Worker: Hello World (part 02)

Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#2-hello-world

Summary

In sw.ts, create an application using Hono and register it to the fetch event with the Service Worker adapter’s handle function. This allows the Hono application to intercept access to /sw. ```ts // To support types // https://gi...

Content

In sw.ts, create an application using Hono and register it to the fetch event with the Service Worker adapter’s handle function. This allows the Hono application to intercept access to /sw.

// To support types
// https://github.com/microsoft/TypeScript/issues/14877
declare const self: ServiceWorkerGlobalScope

import { Hono } from 'hono'
import { handle } from 'hono/service-worker'

const app = new Hono().basePath('/sw')
app.get('/', (c) => c.text('Hello World'))

self.addEventListener('fetch', handle(app))

Metadata

{
  "chunk_index": 1,
  "citation": "https://hono.dev/llms-full.txt#2-hello-world",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / Service Worker > 2. Hello World (2)",
  "retrieved_at": "2026-07-02T05:51:01Z",
  "section_index": 482,
  "source_id": "/honojs/hono",
  "source_type": "llms_full",
  "target_label": "llms-full",
  "title": "Service Worker: Hello World (part 02)",
  "upstream_url": "https://hono.dev/llms-full.txt",
  "version": "2026"
}
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Knowledge/sources/honojs__hono/llms-full/service-worker-hello-world--part-02--3ecb8d14128c.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.