PasteLite

Thank you for using PasteLite, you can customize this homepage by editing:

static/index.html
in the project's root directory

API Routes

Route Description Query Parameters Return value
POST
/paste
Creates a new paste with type determined by content-type

*URL only included if PASTE_URL_PREFIX is set
  • expires (optional) - Time in seconds for the paste to expire, if not set, falls back to the host's default which is 1 day if unchanged. Set to '0' to never expire (unless host has set a maximum)
  • textOnly (optional) - Will not return json but plain text of %id%\n%deletetoken%\n%url%*
{
name,
url, *
expires,
type,
deleteToken
}
GET
/:name
/:name.html
Display a paste in html with syntax highlighting
  • theme (optional) - Set to 'light' for light mode, default is dark mode
HTML site
GET
/:name/raw
/:name.txt
Returns the paste content as
text/plain
None text/plain content
GET
/:name/json
/:name.json
Returns the paste content as JSON, or 404 if unavailable (not JSON) None application/json content
GET
/:name/meta
/:name.meta.json
Returns metadata about paste in JSON None
{
name,
content,
type,
expires
}
DELETE
/:name/deleteToken
Deletes the paste if delete token matches None 204 on success

Response Headers

All the GET routes also return the following headers:


Configuring

Configuration is done using environmental variables, either you can set these using export or ENV_VAR=value node ..., or you can create a .env file in the project root with each line being a variable

Here is all the possible configurations:

Name Description Default
WEB_PORT The port to run the server on 8080
PASTE_DEFAULT_EXPIRES The default time in seconds that a paste will expire, unless overwritten 86400 (1 day)
PASTE_MAX_EXPIRES If set, clamps the expires time to this value not set
PASTE_ALLOWED_MIMES A comma-separated list of mime types to allow, in addition to text/* application/json
PASTE_ID_ALPHABET The characters chosen for a paste's unique id 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
PASTE_ID_LENGTH How long a paste's id should be 12
PASTE_URL_PREFIX If set, a 'url' field added to creation with this not set
BODY_LIMIT Fastify's max request body size 1048576 (1MiB)
PASTE_CLEANUP_INTERVAL How often to check for pastes to be cleaned up in seconds. It is not the actual paste expiration. 3600