Skip to content

Instantly share code, notes, and snippets.

@gmoqa
Created April 26, 2021 23:56
Show Gist options
  • Save gmoqa/08d53e4346de29075de9c5e6bba1562b to your computer and use it in GitHub Desktop.
Save gmoqa/08d53e4346de29075de9c5e6bba1562b to your computer and use it in GitHub Desktop.
Disable HTTP Methods in Nuxt.js
const allowedMethods = ['GET', 'HEAD']
export default function (req, res, next) {
if (!allowedMethods.includes(req.method)) {
res.writeHead(405)
res.end('Method Not Allowed')
return
}
next()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment