2023-02-10 21:43:07 +00:00
|
|
|
import { Hono, RegExpRouter } from '../../deno_dist/mod.ts'
|
2022-07-02 08:51:59 +00:00
|
|
|
|
2023-02-10 21:43:07 +00:00
|
|
|
const app = new Hono({ router: new RegExpRouter() })
|
2022-07-02 08:51:59 +00:00
|
|
|
|
|
|
|
app.get('/user', (c) => c.text('User'))
|
|
|
|
app.get('/user/comments', (c) => c.text('User Comments'))
|
|
|
|
app.get('/user/avatar', (c) => c.text('User Avatar'))
|
|
|
|
app.get('/user/lookup/email/:address', (c) => c.text('User Lookup Email Address'))
|
|
|
|
app.get('/event/:id', (c) => c.text('Event'))
|
|
|
|
app.get('/event/:id/comments', (c) => c.text('Event Comments'))
|
|
|
|
app.post('/event/:id/comments', (c) => c.text('POST Event Comments'))
|
|
|
|
app.post('/status', (c) => c.text('Status'))
|
|
|
|
app.get('/very/deeply/nested/route/hello/there', (c) => c.text('Very Deeply Nested Route'))
|
|
|
|
app.get('/user/lookup/username/:username', (c) => {
|
|
|
|
return c.json({ message: `Hello ${c.req.param('username')}` })
|
|
|
|
})
|
|
|
|
|
2022-09-21 01:31:21 +00:00
|
|
|
Deno.serve(app.fetch, {
|
|
|
|
port: 8000,
|
|
|
|
})
|