https://github.com/daveinchy/mongodb-proxy
https://github.com/daveinchy/mongodb-proxy
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/daveinchy/mongodb-proxy
- Owner: DaveInchy
- Created: 2022-09-16T08:49:03.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-13T12:00:40.000Z (over 2 years ago)
- Last Synced: 2025-01-02T23:41:57.029Z (over 1 year ago)
- Language: TypeScript
- Homepage: mongodb-rest.vercel.app
- Size: 62.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# MongoDB Atlas (CRUD) Proxy
this project is based on the edge network that mongodb offers with a free tier to host your document based database.
## Installing
1. Make an `.env` file in the project root.
2. Copy this configuration and paste it in the `.env` file.
```env
AUTH_KEY=your_static_secret_key
```
3. Run `$ npm i --include=dev && npm run dev;` to install the dependencies and starts the dev server with hot reloading.
# Build Redistributables
```bash
npm run build
```
# Using the api
## 1. Key-Value Pair Tables
### CREATE
```bash
curl -X POST http://localhost:8080/api/kv/table/mytable \
-H "Bearer: "
```
### DELETE
```bash
curl -X DELETE http://localhost:8080/api/kv/table/mytable \
-H "Bearer: "
```
## 2. Key-Value Pairs
### LIST
```bash
curl -X GET http://localhost:8080/api/kv/mytable \
-H "Bearer: "
```
### CREATE
```bash
curl -X POST http://localhost:8080/api/kv/mytable/mykey \
-H "Content-Type: application/json" -H "Bearer: " -d '{"value":"some value"}'
```
### READ
```bash
curl -X GET http://localhost:8080/api/kv/mytable/mykey \
-H "Bearer: "
```
### UPDATE
```bash
curl -X PUT http://localhost:8080/api/kv/mytable/mykey \
-H "Content-Type: application/json" \
-H "Bearer: " -d '{"value":"new value"}'
```
### DELETE
```bash
curl -X DELETE http://localhost:8080/api/kv/mytable/mykey \
-H "Bearer: "
```
Signed by Dave.