new Router(resolver)
Routes HTTP requests
Parameters:
Name | Type | Description |
---|---|---|
resolver |
Resolver | The resolver object |
Methods
attach(server, onRequest) → {https.Server}
Attach request handlers to a server
Parameters:
Name | Type | Description |
---|---|---|
server |
https.Server | The server to attach to |
onRequest |
function | A request handler with signature (request, response, next) |
Returns:
The server (chainable)
- Type
- https.Server
(async) getObject(url, req, res)
Handle a request for an activitypub object
Parameters:
Name | Type | Description |
---|---|---|
url |
URL | The URL of the incoming request |
req |
https.ClientRequest | The incoming request object |
res |
https.ServerResponse | The resonse to send back |
Returns:
true if the request was handled successfuly, else false
(async) getWebfinger(URL)
Handle webfinger request
Parameters:
Name | Type | Description |
---|---|---|
URL |
url The URL of the incoming request | |
https.ServerResponse |
res The response to send back to the server |
(async) handleRequest(request, response)
Handle an incoming HTTP request
Parameters:
Name | Type | Description |
---|---|---|
request |
https.ClientRequest | The incoming request |
response |
https.ServerResponse | The response to return |
Returns:
true if the request was handled successfuly, else false
(async) verifySignature(url, req)
Verify signature of incoming request is valid
Parameters:
Name | Type | Description |
---|---|---|
url |
url | URL of incoming request |
req |
http.IncomingRequest | Request to verify |