mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
21 lines
473 B
TypeScript
21 lines
473 B
TypeScript
import { NextApiRequest, NextApiResponse } from 'next'
|
|
import { getBookedDays } from '../../db/index'
|
|
|
|
export default async function useHandler(
|
|
req: NextApiRequest,
|
|
res: NextApiResponse
|
|
) {
|
|
const { method } = req
|
|
|
|
switch (method) {
|
|
case 'GET':
|
|
const days = await getBookedDays()
|
|
res.statusCode = 200
|
|
res.json(days)
|
|
break
|
|
default:
|
|
res.setHeader('Allow', ['GET'])
|
|
res.status(405).end(`Method ${method} Not Allowed`)
|
|
}
|
|
}
|