Skip to content

Commit

Permalink
feat: test context variables
Browse files Browse the repository at this point in the history
  • Loading branch information
raae committed Oct 8, 2021
1 parent 6450213 commit 08019ce
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/api/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default async function handler(req, res) {
console.log(`${req.baseUrl} - ${req.method}`)

try {
if (req.method === "GET") {
res.json({ test: process.env.TEST })
} else {
throw createError(405, `${req.method} not allowed`)
}
} catch (error) {
errorHandler(req, res, error)
}
}

0 comments on commit 08019ce

Please sign in to comment.