mongo_service

Crates.iomongo_service
lib.rsmongo_service
version0.3.1
sourcesrc
created_at2020-11-12 04:07:09.877569
updated_at2020-11-22 03:12:25.171118
descriptionGeneral CRUD RESTful APIs for MongoDB.
homepage
repositoryhttps://github.com/J-F-Liu/mongo_service.git
max_upload_size
id311470
size72,732
Junfeng Liu (J-F-Liu)

documentation

README

mongo_service

Crates.io Docs

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

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?;
Commit count: 14

cargo fmt