more hacking

This commit is contained in:
Thomas Ruoff
2020-07-26 00:12:51 +02:00
parent 90a9288e84
commit 518b437d14
13 changed files with 166 additions and 54 deletions

18
pages/api/daysbooked.js Normal file
View File

@@ -0,0 +1,18 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { getBookedDays } from '../../db/index'
export default async function useHandler(req, res) {
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`)
}
}