PasteAPI is an API based minimal replica of paste bin. It allows you to store and share text snippets with others. You can create, and read text snippets using this API.
- Create a new paste
- Read an existing paste
- List all pastes
- List a random paste
GET /- Shows documentationGET /pastes- Lists all pastesGET /pastes/random- Shows a random pasteGET /pastes/:id- Shows a paste with the given idPOST /paste- Creates a new paste- Request Body:
{ content: string }
- Request Body:
- Deno
- Deno Deploy
- TypeScript
- KV Database
- Oak
- Clone the repository
- Install dependencies using
deno install - Create a
.envfile and add the following environment variables:DB_PATH: path for a local KV database
- Run the server using
deno run dev
This code base is deployed on the Deno Deploy Infrastructure thus deploying it on your own account of Deno Deploy will be a butter smooth process. But if you want to host it on your own server then you can follow the below steps:
- Clone this repository on your server
- Install Deno and run
deno installto install all the dependencies - Create a
.envfile and add the following environment variables:DB_PATH: path for a local KV database
- Run the server using
deno run start
NOTE: It is recommended to run this as a system service as you can configure it to automatically restarts in case of a crash. You can use
systemdfor this purpose. Follow this guide for more info.
NOTE: Some permanent paste IDs are hardcoded in the codebase at
src/constants.tswhich would obviously differ for your hosted service which you can change as per your preference.