Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marirs/rocket-mongo
REST API Service using Rust & Rocket with MongoDB as backend
https://github.com/marirs/rocket-mongo
api api-rest mongo mongodb rest rocket rust rust-lang
Last synced: 21 days ago
JSON representation
REST API Service using Rust & Rocket with MongoDB as backend
- Host: GitHub
- URL: https://github.com/marirs/rocket-mongo
- Owner: marirs
- License: mit
- Created: 2021-08-08T05:13:13.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-05T05:12:36.000Z (almost 3 years ago)
- Last Synced: 2024-11-08T22:50:40.701Z (3 months ago)
- Topics: api, api-rest, mongo, mongodb, rest, rocket, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rocket Mongo
[![build](https://github.com/marirs/rocket-mongo/actions/workflows/ci.yml/badge.svg)](https://github.com/marirs/rocket-mongo/actions/workflows/ci.yml)
![](https://img.shields.io/badge/os-windows%7Clinux%7Cmacos-orange)
![](https://img.shields.io/badge/platform-intel%7Carm-yellowgreen)
![GitHub](https://img.shields.io/github/license/marirs/rocket-mongo?style=plastic)A Simple Skeleton API Rest server using [Rocket](https://rocket.rs/) with the backend database as [MongoDB](https://www.mongodb.com/).
### Features
- Custom config file defining:
- server host ip and port to listen
- enable/disable ssl with ssl cert auto generation
- mongodb configurations
- Use the `x-api-key` header to validate `API Keys`
- `Restrict` a client connecting IP Addresses to the endpoints using `Allow ACL`
- `Restrict` endpoints using the `Allow ACL`### Requirements
- Rust 1.56+ (2021 edition)
### Compile
```bash
cargo build --release
```- Sample config file is available at `config.yml`
### Available endpoints
- Index/User management endpoint
| Description | Endpoint | Method |
| --- | --- | --- |
| Api index | `/` | GET |
| List all Users | `/users` | GET |
| Create user | `/users` | POST |
| Update user | `/users` | PUT |
| Delete user | `/users/` | DELETE |### POST Request for `new user creation` / `user update`
The below example goes into json body of POST/PUT request while creating a new user
```
{
"email": "email",
"description": "...",
"is_admin": false,
"acl_allow_ips": ["127.0.0.1", ""] // use ["*"] if you want to allow from any IP
"acl_allow_endpoints": ["/users"] // use ["*"] if you want to allow all endpoints access
}
```### Seed data & Configuration
```json
{
"created_ip" : "127.0.0.1",
"created_by" : "email",
"created_at" : "2021-08-02T00:00:00Z",
"email" : "email",
"description": "...",
"api_key" : "apikey123",
"is_admin" : true,
"acl_allow_ips" : ["*"],
"acl_allow_endpoints": ["*"]
}
```
### Other projects- If you want with Rate-Limit, go [here](https://github.com/marirs/rocketapi).
- If you want with JWT Auth, go [here](https://github.com/marirs/rocket-jwt).---
License: MIT