mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 06:57:12 +01:00
more hacking
This commit is contained in:
14
pages/api/booking.js
Normal file
14
pages/api/booking.js
Normal 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`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user