comparison benchmark/bun-http-framework-benchmark/dev/adonis/start/routes.ts @ 186:8cf4ec5e2191 hg-web

Fixed merge conflict.
author MrJuneJune <me@mrjunejune.com>
date Fri, 23 Jan 2026 22:38:59 -0800
parents a8976a008a9d
children
comparison
equal deleted inserted replaced
176:fed99fc04e12 186:8cf4ec5e2191
1 /*
2 |--------------------------------------------------------------------------
3 | Routes
4 |--------------------------------------------------------------------------
5 |
6 | This file is dedicated for defining HTTP routes. A single file is enough
7 | for majority of projects, however you can define routes in different
8 | files and just make sure to import them inside this file. For example
9 |
10 | Define routes in following two files
11 | ├── start/routes/cart.ts
12 | ├── start/routes/customer.ts
13 |
14 | and then import them inside `start/routes.ts` as follows
15 |
16 | import './routes/cart'
17 | import './routes/customer'
18 |
19 */
20
21 import Route from '@ioc:Adonis/Core/Route'
22
23 Route.get('/', () => 'hi')
24 Route.get('/id/:id', ({ params, request, response }) => {
25 response.header('x-powered-by', 'benchmark')
26
27 return `${params.id} ${request.qs().name}`
28 })
29 Route.post('/json', ({ request }) => request.body())