oluceps / rust-web-mongodb-example

An example using MongoDB in a Rust Web Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rust-web-mongodb-example

An example using MongoDB in a Rust Web Service

Run

make mongostart

make dev

Runs a local mongodb instance using Docker and an HTTP server on http://localhost:8080.

You can then use CRUD operations on the book resource like this:

Fetch all books:

curl http://localhost:8080/book

Create a new book:

curl -X POST http://localhost:8080/book -d '{"name": "good book", "author": "another", "num_pages": 500, "tags": ["fun"]}' -H "content-type: application/json"

Edit a book:

curl -X PUT http://localhost:8080/book/5f15fd5400b98edc001944c0 -d '{"name": "good book", "author": "another", "num_pages": 500, "tags": ["fun", "long"]}' -H "content-type: application/json"

Delete a new book:

curl -X DELETE http://localhost:8080/book/5f15fd3900789205001944bf

About

An example using MongoDB in a Rust Web Service

License:Apache License 2.0


Languages

Language:Rust 93.0%Language:Makefile 7.0%