Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cors setup using route options, removed hapi-cors plugin #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

christin-wednesday
Copy link
Contributor

Ticket Link


Closes #69

Related Links


Description


Use the withCors function to create a route that has cors headers enabled.

Instead of using the hapi-cors plugin, use route.options.cors

Supports config overriding.

Default cors origins can be defined in the withCors function, on the basis of env.

Since it is a common use case to conditionally do something on the basis of ENVIRONMENT_NAME, added a function that guards / gate keeps the value of this environment variable.

Also this seemed like a good use case for getters :)

Steps to Reproduce / Test



Checklist

  • PR description included
  • yarn test passes
  • Tests are [changed or added]
  • Relevant documentation is changed or added (and PR referenced)

@github-actions
Copy link

Coverage report

❌ The test suite failed. Please, check the console output for more details.

Error: The process '/usr/local/bin/npx' failed with exit code 1
    at f._setResult (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:11470)
    at f.CheckComplete (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:10900)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:9944)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

Report generated by 🧪jest coverage report action from a13042b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hapi-cors is deprecated
2 participants