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 bb8f5f3 commit 03f452a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/api/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default async function handler(req, res) {
console.log(`${req.baseUrl} - ${req.method}`)

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

0 comments on commit 03f452a

Please sign in to comment.