add mongo
This commit is contained in:
13
pages/api/submit.ts
Normal file
13
pages/api/submit.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {NextApiHandler} from "next";
|
||||
import {Dict, Group} from "../../src/types";
|
||||
import {setGroups} from "../../src/database/groups";
|
||||
|
||||
const handler: NextApiHandler = async (req, res) => {
|
||||
if (req.method !== 'POST') throw new Error('Invalid method')
|
||||
const {groups, ignored, base} = req.body as {groups: Dict<Group>, ignored: string[], base: string[]}
|
||||
const uuid = await setGroups(groups, ignored, base)
|
||||
console.log(uuid)
|
||||
res.json({ uuid })
|
||||
}
|
||||
|
||||
export default handler
|
||||
Reference in New Issue
Block a user