generated from avior/template-web-astro
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