13 lines
341 B
TypeScript
13 lines
341 B
TypeScript
import {NextApiHandler} from "next";
|
|
import {GroupData, setGroups} from "../../src/database/groups";
|
|
|
|
const handler: NextApiHandler = async (req, res) => {
|
|
if (req.method !== 'POST') throw new Error('Invalid method')
|
|
const data = req.body as GroupData
|
|
|
|
const uuid = await setGroups(data)
|
|
res.json({ uuid })
|
|
}
|
|
|
|
export default handler
|