feat: Add Hyperion

Signed-off-by: Avior <git@avior.me>
This commit is contained in:
2024-05-14 17:48:13 +02:00
parent b7c5f5148e
commit 9b2d412a9e
5 changed files with 563 additions and 0 deletions

View 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()
}

View 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()
}