generated from avior/template-web-astro
10
src/pages/api/v1/checkout.ts
Normal file
10
src/pages/api/v1/checkout.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import type { APIRoute } from 'astro'
|
||||
import ResponseBuilder from 'libs/ResponseBuilder'
|
||||
|
||||
function randomInt(min = 0, max = 10) {
|
||||
return Math.round(Math.random() * max + min)
|
||||
}
|
||||
|
||||
export const ALL: APIRoute = ({ url }) => {
|
||||
return new ResponseBuilder().body({caca: 'pokemon', list: [url.searchParams.get('filter'), ...Array(randomInt(1, 20)).fill(0).map(() => randomInt(10, 100))]}).build()
|
||||
}
|
21
src/pages/api/v1/projects/index.ts
Normal file
21
src/pages/api/v1/projects/index.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import type { APIRoute } from 'astro'
|
||||
import ResponseBuilder from 'libs/ResponseBuilder'
|
||||
|
||||
interface Project {
|
||||
name: string
|
||||
id: string
|
||||
}
|
||||
|
||||
export const GET: APIRoute = ({ url }) => {
|
||||
const nameFilter = url.searchParams.get('name')
|
||||
return new ResponseBuilder().body(([
|
||||
{
|
||||
name: 'Holisané',
|
||||
id: 'HOLIS'
|
||||
},
|
||||
{
|
||||
name: 'Aptatio',
|
||||
id: 'APTA'
|
||||
}
|
||||
] as Array<Project>).filter((it) => !nameFilter || it.name.includes(nameFilter))).build()
|
||||
}
|
Reference in New Issue
Block a user