https://github.com/skorotkiewicz/restpaste
JSON to RestFul API Pastebin
https://github.com/skorotkiewicz/restpaste
express json nodejs postgres prisma restful-api
Last synced: 2 months ago
JSON representation
JSON to RestFul API Pastebin
- Host: GitHub
- URL: https://github.com/skorotkiewicz/restpaste
- Owner: skorotkiewicz
- Created: 2023-04-29T14:27:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-30T06:59:43.000Z (about 2 years ago)
- Last Synced: 2025-01-31T12:34:24.301Z (4 months ago)
- Topics: express, json, nodejs, postgres, prisma, restful-api
- Language: JavaScript
- Homepage: https://restpaste.fly.dev
- Size: 56.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RestPaste
This JSON pastebin allows to store and retrieve JSON data through a simple RESTful API. Create new pastes by sending a POST request with the JSON data.
The API also supports partial retrieval of data using the fields query parameter. Specify a comma-separated list of fields they want to retrieve, and the API will return only those fields from the JSON data.
This pastebin is designed to be simple and easy to use, with a minimal API and no authentication required. However, users should be aware that pastes are publicly accessible and should not include any sensitive or confidential information.
To try it out locally, download the repository and install the dependencies.
Remember to rename the `dotenv` file to `.env` and fill it in with your own data.
```sh
yarn installnpx prisma generate
npx prisma migrate dev # development
npx prisma migrate deploy # productionyarn dev # start the development server
yarn start # start the production server
```## Example Paste
```json
[
{
"path": "/test3",
"key": "hello3",
"value": "world3"
},
{
"path": "/test4",
"key": "hello4",
"value": "world4"
}
]
```Request:
```text
http://localhost:5000/api/paste/clh1qxopp00003xiajdzqg2vp/test3
```Returns:
```json
{ "hello3": "world3" }
```## Example Paste for any JSON
```
{
"pet1": {
"petName": "Claudine",
"petType": "House cat"
},
"pet2": {
"petName": "Sunny",
"petType": "Gerbil"
}
}
```Request:
```text
http://localhost:5000/api/fpaste/json/clh30axuj00003xjvimyk6m8z?fields=petName,petType
```Returns:
```json
{
"pet1": {
"petName": "Claudine",
"petType": "House cat"
},
"pet2": {
"petName": "Sunny",
"petType": "Gerbil"
}
}
```