-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* changeset * Go * Prettuer
- Loading branch information
Showing
7 changed files
with
190 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
'@whatwg-node/server': minor | ||
--- | ||
|
||
Improvements; | ||
|
||
- `createServerAdapter` can now accept the request handler itself. | ||
|
||
```ts | ||
createServerAdapter(req => { | ||
return new Response(`I got ${req.url}`) | ||
}) | ||
``` | ||
|
||
Breaking Changes; | ||
|
||
- `baseObject` in the configuration has been removed! Now you can pass `baseObject` itself but `baseObject` needs to implement a `handle` method that is exactly same with `handleRequest`. | ||
|
||
```diff | ||
- const myServerBaseObject = {...} | ||
+ const myServerBaseObject = { | ||
+ handle(req) {/*...*/} | ||
+ } | ||
|
||
- const adapter = createServerAdapter({ | ||
- baseObject: myServerBaseObject, | ||
- handleRequest(req) {/*...*/} | ||
- }) | ||
+ const adapter = createServerAdapter(myServerBaseObject) | ||
``` | ||
|
||
- `handleRequest` has been renamed to `handle` which has the same signature. | ||
|
||
```diff | ||
createServerAdapter({ | ||
- handleRequest(request) { | ||
+ handle(request) { | ||
}) | ||
``` | ||
|
||
- `Request` in the configuration needs to be passed as a second argument. | ||
|
||
```diff | ||
createServerAdapter({ | ||
- handleRequest(request) { | ||
+ handle(request) { | ||
- Request: MyRequestCtor | ||
- }) | ||
+ }, MyRequestCtor) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.