https://github.com/j-f-liu/mongo_service
General CRUD RESTful APIs for MongoDB.
https://github.com/j-f-liu/mongo_service
Last synced: 3 months ago
JSON representation
General CRUD RESTful APIs for MongoDB.
- Host: GitHub
- URL: https://github.com/j-f-liu/mongo_service
- Owner: J-F-Liu
- Created: 2020-11-11T15:05:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-22T03:12:52.000Z (over 4 years ago)
- Last Synced: 2025-01-29T04:46:29.139Z (4 months ago)
- Language: Rust
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mongo_service
[](https://crates.io/crates/mongo_service)
[](https://docs.rs/mongo_service)General CRUD RESTful APIs for MongoDB.
### Routes
- /:collection
- GET - Get object list
- POST - Create new object
- /:collection/:id
- GET - Get object
- PUT - Update object with new field values
- PATCH - Update object with MongoDB update operators
- DELETE - Delete object### Usage
```rust
use mongodb::Client;let client = Client::with_uri_str("mongodb://localhost:27017").await?;
let mut app = tide::new();
app.at("/api").nest(mongo_service::serve(client.database("database")));
app.listen("127.0.0.1:8080").await?;
```