mirror of
https://github.com/sbrl/powahroot.git
synced 2024-11-23 22:53:00 +00:00
Server: fix docs for handle()
This commit is contained in:
parent
58e1b42438
commit
e301dfd226
2 changed files with 7 additions and 6 deletions
|
@ -74,7 +74,7 @@ router.get("/files/::filepath", (context, _next) => context.send.plain(200, `You
|
||||||
// .....
|
// .....
|
||||||
|
|
||||||
// Later, when you've got a request / response pair to handle:
|
// Later, when you've got a request / response pair to handle:
|
||||||
router.handle(request, response);
|
await router.handle(request, response);
|
||||||
```
|
```
|
||||||
|
|
||||||
The `context` argument there is of type `RouterContext`. Check out the API reference (link below) to learn about the other useful properties it has.
|
The `context` argument there is of type `RouterContext`. Check out the API reference (link below) to learn about the other useful properties it has.
|
||||||
|
|
|
@ -160,12 +160,13 @@ class ServerRouter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the specified request.
|
* Handles the specified request.
|
||||||
* @param {http.ClientRequest} request The request to handle.
|
* Don't forget to await the Promise!
|
||||||
* @param {http.ServerResponse} response The response object to use to send the response.
|
* @param {http.ClientRequest} request The request to handle.
|
||||||
* @return {[type]} [description]
|
* @param {http.ServerResponse} response The response object to use to send the response.
|
||||||
|
* @return {Promise} A Promise that resolves when handling is complete.
|
||||||
* @example
|
* @example
|
||||||
* const server = http.createServer((request, response) => {
|
* const server = http.createServer(async (request, response) => {
|
||||||
* router.handle(request, response);
|
* await router.handle(request, response);
|
||||||
* });
|
* });
|
||||||
* server.listen(3500, "127.0.0.1", () => console.log("Listening on http://127.0.0.1:3500/"));
|
* server.listen(3500, "127.0.0.1", () => console.log("Listening on http://127.0.0.1:3500/"));
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue