@@ -8,7 +8,7 @@ There are all `Server` classes feature.
8
8
Your endpoints must implement ` Endpoint ` class interface (` route() ` and ` async handle(request) ` methods).
9
9
10
10
``` javascript
11
- const http = require (' node:http' );
11
+ const createServerFunction = require (' node:http' ). createServer ;
12
12
13
13
const {
14
14
Server ,
@@ -34,7 +34,7 @@ new LoggedServer(
34
34
{port: server_port},
35
35
new LoggedInputRequest (new JsonInputRequest (new InputRequest ()), console ),
36
36
new LoggedOutputResponse (new JsonOutputResponse (new OutputResponse ()), console ),
37
- http
37
+ createServerFunction
38
38
),
39
39
console
40
40
).start ();
@@ -74,8 +74,8 @@ class MyEndpoint {
74
74
## Client
75
75
76
76
``` javascript
77
- const http = require (' node:http' );
78
- const requestFunction = http . request ;
77
+ const requestFunction = require (' node:http' ). request ;
78
+
79
79
const {
80
80
OutputRequest ,
81
81
InputResponse
@@ -122,7 +122,7 @@ And you should replace `node:http` package with `objective-http.bun.bunttp` in y
122
122
It should work with ` node ` and ` bun ` :
123
123
124
124
``` javascript
125
- const http = require (' node:http' );
125
+ const createServerFunction = require (' node:http' ). createServer ;
126
126
127
127
const {
128
128
Server ,
@@ -148,7 +148,7 @@ new LoggedServer(
148
148
{port: server_port},
149
149
new LoggedInputRequest (new JsonInputRequest (new InputRequest ()), console ),
150
150
new LoggedOutputResponse (new JsonOutputResponse (new OutputResponse ()), console ),
151
- http
151
+ createServerFunction
152
152
),
153
153
console
154
154
).start ()
@@ -158,7 +158,7 @@ In order for the code to be executed only by `bun` (with `Bun API` inside), you
158
158
` bun ` package redeclare only ` InputRequest ` and ` OutputResponse ` classes. Other classes taken from ` server ` package.
159
159
160
160
``` javascript
161
- const http = require (' objective-http' ).bun .bunttp ;
161
+ const createServerFunction = require (' objective-http' ).bun .bunttp . createServer ;
162
162
163
163
const {
164
164
Server ,
@@ -181,8 +181,8 @@ const {
181
181
It should work with ` node ` and ` bun ` :
182
182
183
183
``` javascript
184
- const http = require (' node:http' );
185
- const requestFunction = http . request ;
184
+ const requestFunction = require (' node:http' ). request ;
185
+
186
186
const {
187
187
OutputRequest ,
188
188
InputResponse
@@ -200,8 +200,8 @@ await (new OutputRequest(new InputResponse(), requestFunction)
200
200
In order for the code to be executed only by ` bun ` , you need to make changes to the import block.
201
201
202
202
``` javascript
203
- const http = require (' objective-http' ).bun .bunttp ;
204
- const requestFunction = http . request ;
203
+ const requestFunction = require (' objective-http' ).bun .bunttp . request ;
204
+
205
205
const {
206
206
OutputRequest ,
207
207
InputResponse
0 commit comments