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

14
pages/api/booking.js Normal file
View File

@@ -0,0 +1,14 @@
import { createBooking } from '../../db/index'
export default async function userHandler(req, res) {
const { method } = req
switch (method) {
case 'POST':
const data = await createBooking(req.body)
res.status(200).json(data)
break
default:
res.setHeader('Allow', ['POST'])
res.status(405).end(`Method ${method} Not Allowed`)
}
}