## server
thread-keeper
**Author**: The Harvard Library Innovation Lab
**License**: MIT
* [server](#module_server)
* _static_
* [.successLog](#module_server.successLog) : SuccessLog
* [.CAPTURES_WATCH](#module_server.CAPTURES_WATCH) : Object
* _inner_
* [~accessKeys](#module_server..accessKeys) : AccessKeys
* [~index(request, reply)](#module_server..index) ⇒ Promise.<fastify.FastifyReply>
* [~capture(request, reply)](#module_server..capture) ⇒ Promise.<fastify.FastifyReply>
* [~check(request, reply)](#module_server..check) ⇒ Promise.<fastify.FastifyReply>
* [~checkHash(request, reply)](#module_server..checkHash) ⇒ Promise.<fastify.FastifyReply>
### server.successLog : SuccessLog
**Kind**: static constant of [server
](#module_server)
### server.CAPTURES\_WATCH : Object
Keeps track of how many capture processes are currently running.
May be used to redirect users if over capacity.
[!] Only good for early prototyping.
**Kind**: static constant of [server
](#module_server)
### server~accessKeys : AccessKeys
**Kind**: inner constant of [server
](#module_server)
### server~index(request, reply) ⇒ Promise.<fastify.FastifyReply>
[GET] /
Shows the landing page and capture form.
Assumes `fastify` is in scope.
**Kind**: inner method of [server
](#module_server)
| Param | Type |
| --- | --- |
| request | fastify.FastifyRequest
|
| reply | fastify.FastifyReply
|
### server~capture(request, reply) ⇒ Promise.<fastify.FastifyReply>
[POST] `/`
Processes a request to capture a `twitter.com` url.
Serves PDF bytes directly if operation is successful.
Returns to form with specific error code, passed as `errorReason`, otherwise.
Subject to captures rate limiting (see `CAPTURES_WATCH`).
Body is expected as `application/x-www-form-urlencoded` with the following fields:
- access-key
- url
- unfold-thread (optional)
Assumes `fastify` is in scope.
**Kind**: inner method of [server
](#module_server)
| Param | Type |
| --- | --- |
| request | fastify.FastifyRequest
|
| reply | fastify.FastifyReply
|
### server~check(request, reply) ⇒ Promise.<fastify.FastifyReply>
[GET] /check
Shows the "check" page /check form. Loads certificates history files in the process.
Assumes `fastify` is in scope.
**Kind**: inner method of [server
](#module_server)
| Param | Type |
| --- | --- |
| request | fastify.FastifyRequest
|
| reply | fastify.FastifyReply
|
### server~checkHash(request, reply) ⇒ Promise.<fastify.FastifyReply>
[GET] `/api/v1/hashes/check/`.
Checks if a given SHA512 hash is in the "success" logs, meaning this app created it.
Hash is passed as the last parameter, url encoded.
Assumes `fastify` is in scope.
Returns HTTP 200 if found, HTTP 404 if not.
**Kind**: inner method of [server
](#module_server)
| Param | Type |
| --- | --- |
| request | fastify.FastifyRequest
|
| reply | fastify.FastifyReply
|