5 unstable releases

0.3.1 Nov 22, 2020
0.3.0 Nov 22, 2020
0.2.0 Nov 13, 2020
0.1.1 Nov 12, 2020
0.1.0 Nov 12, 2020

#1245 in HTTP server

MIT license

20KB
221 lines

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?;

Dependencies

~31–45MB
~886K SLoC