A Simple Skeleton API Rest server using Rocket with the backend database as MongoDB.
- 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-keyheader to validateAPI Keys Restricta client connecting IP Addresses to the endpoints usingAllow ACLRestrictendpoints using theAllow ACL
- Rust 1.56+ (2021 edition)
cargo build --release- Sample config file is available at
config.yml
- 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/<Email> |
DELETE |
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", "<IP_ADDRESS>"] // use ["*"] if you want to allow from any IP
"acl_allow_endpoints": ["/users"] // use ["*"] if you want to allow all endpoints access
}
{
"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": ["*"]
}License: MIT