Skip to content

zupzup/rust-web-mongodb-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published