mirror of
https://github.com/System-End/cdn.git
synced 2026-04-19 18:35:12 +00:00
Enforce POSTing
This commit is contained in:
parent
5065bbd612
commit
c70837aa55
1 changed files with 20 additions and 3 deletions
23
api/new.js
23
api/new.js
|
|
@ -1,9 +1,26 @@
|
|||
// process.env.
|
||||
|
||||
// https://api.vercel.com/v2/now/files
|
||||
|
||||
// https://api.vercel/v12/now/files
|
||||
|
||||
// Vercel protects against env tokens starting with `VERCEL_`, so we're calling
|
||||
// it the ZEIT_TOKEN
|
||||
const zeitToken = process.env.ZEIT_TOKEN
|
||||
|
||||
export default (req, res) => {
|
||||
res.json({ ping: 'pong' })
|
||||
if (req.method == 'OPTIONS') {
|
||||
return res.status(204).json({ status: "YIPPE YAY. YOU HAVE CLEARANCE TO PROCEED." })
|
||||
}
|
||||
if (req.method == 'GET') {
|
||||
return res.status(405).json({ error: '*GET outta here!* (Method not allowed, use POST)' })
|
||||
}
|
||||
if (req.method == 'PUT') {
|
||||
return res.status(405).json({ error: '*PUT that request away!* (Method not allowed, use POST)' })
|
||||
}
|
||||
if (req.method !== 'POST') {
|
||||
return res.status(405).json({ error: 'Method not allowed, use POST' })
|
||||
}
|
||||
|
||||
res.send(req.body)
|
||||
|
||||
// res.json({ ping: 'pong' })
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue