This is PastaBin's REST API.
PastaBin is a very simplifyed version of Pastbin.
It supports 2 methods:
- GET /:id (or /paste/:id) -> retrieve data of paste with certain id.
- returns:
{ "id": "<id string>", "data": "<paste text>", "expiresAt": "<ISO 8601 date>" }
- POST /paste/ -> create new paste.
- body:
{ "data": "<paste text>" }
- returns:
{ "id": "<id>" }
Obvious disclaimer: Requirements such as scalability, security, etc. were not taken into account in this assigment.
These instructions get the project running on local machine for development and testing purposes.
- Node.js 12.22
- MySQL v8
Copy .env.template
file to .env
and configure environment variables for development server:
- Port
- Database connection
Install NPM dependencies:
npm i
Run the development server:
npm start
npm test
The API is deployed at: https://api-pastabin.herokuapp.com/