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!: opt-in using event format using defineEventHandler #74

Merged
merged 2 commits into from
Mar 23, 2022

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Mar 23, 2022

A bit of context: #73

This refactor, is starting point to move away from (req, res) signature to (event) format with utilities with minimum possible changes to both core and usage. event is still a simple function { req, res }.

Tests are untouched and handlers will be automatically upgraded with a wrapper to event format, unless directly opting in an using defineEventHandler. Still using a semver-minor to alert about potential behavior changes.

// Keeps working
app.use((req, res) => 'Hello World!')

// Opt-in to new event format
import { defineEventHandler } from 'h3'

app.use(defineEventHandler(() => 'Hello World'))

@pi0 pi0 changed the title feat!: use event handler format feat: use event handler format Mar 23, 2022
@pi0 pi0 changed the title feat: use event handler format feat: opt-in using event format using defineEventHandler Mar 23, 2022
@pi0 pi0 mentioned this pull request Mar 23, 2022
7 tasks
@pi0 pi0 changed the title feat: opt-in using event format using defineEventHandler feat!: opt-in using event format using defineEventHandler Mar 23, 2022
@pi0 pi0 merged commit cdf9b7c into main Mar 23, 2022
@pi0 pi0 deleted the refactor/event-format branch March 23, 2022 12:06
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.

None yet

1 participant