0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 10:51:01 +00:00
hono/benchmarks/deno/oak.ts

25 lines
740 B
TypeScript
Raw Normal View History

import { Application, Router } from 'https://deno.land/x/oak@v10.5.1/mod.ts'
const router = new Router()
router.get('/user', () => {})
router.get('/user/comments', () => {})
router.get('/user/avatar', () => {})
router.get('/user/lookup/email/:address', () => {})
router.get('/event/:id', () => {})
router.get('/event/:id/comments', () => {})
router.post('/event/:id/comments', () => {})
router.post('/status', () => {})
router.get('/very/deeply/nested/route/hello/there', () => {})
router.get('/user/lookup/username/:username', (ctx) => {
ctx.response.body = {
message: `Hello ${ctx.params.username}`,
}
})
const app = new Application()
app.use(router.routes())
app.use(router.allowedMethods())
await app.listen({ port: 8000 })