view benchmark/bun-http-framework-benchmark/src/deno/deno-web-standard.ts @ 263:ee04e4e69fed

Add functional JRPG frame and tools Add full-screen background_2 apertures, functional frame chrome, card-driven details, dual-window tools, live conversion workflows, and bounded cleanup for generated downloads. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <mrjunejune@users.noreply.github.com>
date Thu, 06 Aug 2026 11:31:30 -0700
parents a8976a008a9d
children
line wrap: on
line source

// @ts-nocheck
Deno.serve({ port: 3000 }, async (request) => {
    const url = new URL(request.url)

    switch (request.method) {
        case 'GET':
            switch (url.pathname) {
                case '/':
                    return new Response('Hi')
            }

            if (url.pathname.startsWith('/id/')) {
                const [id, rest] = url.pathname.slice(4).split('/')

                if (!rest)
                    return new Response(
                        `${id} ${url.searchParams.get('name')}`,
                        {
                            headers: {
                                'x-powered-by': 'benchmark'
                            }
                        }
                    )
            }

            return new Response('Not Found', {
                status: 404
            })

        case 'POST':
            switch (url.pathname) {
                case '/json':
                    return Response.json(await request.json())

                default:
                    return new Response('Not Found', {
                        status: 404
                    })
            }

        default:
            return new Response('Not Found', {
                status: 404
            })
    }
})