@@ -8,7 +8,7 @@ There are all `Server` classes feature.
88Your endpoints must implement ` Endpoint ` class interface (` route() ` and ` async handle(request) ` methods).
99
1010``` javascript
11- const http = require (' node:http' );
11+ const createServerFunction = require (' node:http' ). createServer ;
1212
1313const {
1414 Server ,
@@ -34,7 +34,7 @@ new LoggedServer(
3434 {port: server_port},
3535 new LoggedInputRequest (new JsonInputRequest (new InputRequest ()), console ),
3636 new LoggedOutputResponse (new JsonOutputResponse (new OutputResponse ()), console ),
37- http
37+ createServerFunction
3838 ),
3939 console
4040).start ();
@@ -74,8 +74,8 @@ class MyEndpoint {
7474## Client
7575
7676``` javascript
77- const http = require (' node:http' );
78- const requestFunction = http . request ;
77+ const requestFunction = require (' node:http' ). request ;
78+
7979const {
8080 OutputRequest ,
8181 InputResponse
@@ -122,7 +122,7 @@ And you should replace `node:http` package with `objective-http.bun.bunttp` in y
122122It should work with ` node ` and ` bun ` :
123123
124124``` javascript
125- const http = require (' node:http' );
125+ const createServerFunction = require (' node:http' ). createServer ;
126126
127127const {
128128 Server ,
@@ -148,7 +148,7 @@ new LoggedServer(
148148 {port: server_port},
149149 new LoggedInputRequest (new JsonInputRequest (new InputRequest ()), console ),
150150 new LoggedOutputResponse (new JsonOutputResponse (new OutputResponse ()), console ),
151- http
151+ createServerFunction
152152 ),
153153 console
154154).start ()
@@ -158,7 +158,7 @@ In order for the code to be executed only by `bun` (with `Bun API` inside), you
158158` bun ` package redeclare only ` InputRequest ` and ` OutputResponse ` classes. Other classes taken from ` server ` package.
159159
160160``` javascript
161- const http = require (' objective-http' ).bun .bunttp ;
161+ const createServerFunction = require (' objective-http' ).bun .bunttp . createServer ;
162162
163163const {
164164 Server ,
@@ -181,8 +181,8 @@ const {
181181It should work with ` node ` and ` bun ` :
182182
183183``` javascript
184- const http = require (' node:http' );
185- const requestFunction = http . request ;
184+ const requestFunction = require (' node:http' ). request ;
185+
186186const {
187187 OutputRequest ,
188188 InputResponse
@@ -200,8 +200,8 @@ await (new OutputRequest(new InputResponse(), requestFunction)
200200In order for the code to be executed only by ` bun ` , you need to make changes to the import block.
201201
202202``` javascript
203- const http = require (' objective-http' ).bun .bunttp ;
204- const requestFunction = http . request ;
203+ const requestFunction = require (' objective-http' ).bun .bunttp . request ;
204+
205205const {
206206 OutputRequest ,
207207 InputResponse
0 commit comments