1
0
Fork 0
mirror of https://github.com/sbrl/powahroot.git synced 2024-12-26 04:45:01 +00:00

Server: fix docs for handle()

This commit is contained in:
Starbeamrainbowlabs 2022-02-12 15:50:41 +00:00
parent 58e1b42438
commit e301dfd226
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 7 additions and 6 deletions

View file

@ -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:
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.

View file

@ -160,12 +160,13 @@ class ServerRouter
/**
* Handles the specified request.
* @param {http.ClientRequest} request The request to handle.
* @param {http.ServerResponse} response The response object to use to send the response.
* @return {[type]} [description]
* Don't forget to await the Promise!
* @param {http.ClientRequest} request The request to handle.
* @param {http.ServerResponse} response The response object to use to send the response.
* @return {Promise} A Promise that resolves when handling is complete.
* @example
* const server = http.createServer((request, response) => {
* router.handle(request, response);
* const server = http.createServer(async (request, response) => {
* await router.handle(request, response);
* });
* server.listen(3500, "127.0.0.1", () => console.log("Listening on http://127.0.0.1:3500/"));
*/