Skip to content
Myr

docs: fixed readme (#45)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* typo * tweak

authored by Yusuke Wada · committed by GitHub · parent 56de23a · Browse files · 1 file+10 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−10 removed

  • other:+10 added−10 removed

1 file+10 added−10 removed

modified:README.md+10 added-10 removed
11 unmodified lines
12```1314## Features1516- **Ultra Fast** - the router is implemented with Trie-Tree structure.16- **Ultra fast** - the router is implemented with Trie-Tree structure.17- **Zero dependencies** - using only Web standard API.18- **Middleware** - builtin middleware, and you can make your own middleware.19- **Optimized** - for Cloudflare Workers.20
48 unmodified lines
69`app.HTTP_METHOD`7071```js72// HTTP Methods73app.get('/', () => new Response('GET /'))74app.post('/', () => new Response('POST /'))73app.get('/', (c) => c.text('GET /'))74app.post('/', (c) => c.text('POST /'))7576// Wildcard77app.get('/wild/*/card', () => {78 return new Response('GET /wild/*/card')77app.get('/wild/*/card', (c) => {78 return c.text('GET /wild/*/card')79})80```8182`app.all`8384```js85// Any HTTP methods86app.all('/hello', () => new Response('ALL Method /hello'))86app.all('/hello', (c) => c.text('Any Method /hello'))87```8889### Named Parameter90
25 unmodified lines
116117## async/await118119```js120app.get('/fetch-url', async () => {120app.get('/fetch-url', async (c) => {121 const response = await fetch('https://example.com/')122 return new Response(`Status is ${response.status}`)122 return c.text(`Status is ${response.status}`)123})124```125126## Middleware
34 unmodified lines
161 await next()162 await c.res.headers.add('x-message', 'This is middleware!')163})164165app.get('/message/hello', () => 'Hello Middleware!')165app.get('/message/hello', (c) => c.text('Hello Middleware!'))166```167168### Custom 404 Response169
68 unmodified lines
238239### c.event240241```js242// FetchEvent objest242// FetchEvent object243app.use('*', async (c, next) => {244 c.event.waitUntil(245 ...246 )
174 unmodified lines