怎么限制post的次数哇!!

后端用node做了一个新增提问的功能,要怎么限制这个提问次数,在此提出大大的疑惑

router.post('/Addqu', async function (req, res) {
    const { UId } = Decryp(req.headers.authorization.split(" ")[1]).user
    const { UId: PId, content } = req.body
    const qua = await quModule.create({
        content: content,
        PId: PId,
        UId: UId,
    })
    let data = restult('200', qua, '获取成功')
    res.send(data)
})

当然是写入数据库咯,有提问就计入次数呀,接口那边判断,次数超过了就抛出提示

  • 这篇文章:POST请求 也许有你想要的答案,你可以看看