https://github.com/emarifer/rocket_mongo_api
Server/API built using Rust's Rocket.rs framework and MongoDB database running in a Docker container.
https://github.com/emarifer/rocket_mongo_api
docker docker-compose rest-api rocket rust server
Last synced: 2 months ago
JSON representation
Server/API built using Rust's Rocket.rs framework and MongoDB database running in a Docker container.
- Host: GitHub
- URL: https://github.com/emarifer/rocket_mongo_api
- Owner: emarifer
- License: mit
- Created: 2023-03-28T13:05:17.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-28T13:39:52.000Z (about 3 years ago)
- Last Synced: 2025-03-13T23:32:42.457Z (over 1 year ago)
- Topics: docker, docker-compose, rest-api, rocket, rust, server
- Language: Rust
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Server/API built using Rust's Rocket.rs framework and MongoDB database running in a Docker container.
## To run the app:
Apart from the obvious prerequisite of having Rust and Docker installed, we must have an .env file in the project root with the following configuration:
```
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=xxxx
MONGO_INITDB_DATABASE=rust_mongodb
MONGODB_USER_COLLECTION=users
DATABASE_URL=mongodb://admin:xxxx@localhost:27017/rust_mongodb?authSource=admin
```
To create the container with a MongoDB image and a Docker-managed storage volume run in the project root:
```
$ docker compose up -d
```
If we have _cargo-watch_ installed using:
```
$ cargo install cargo-watch
```
we won't have to restart the server every time we make a code change; running the following command in the root of the project:
```
$ cargo watch -x run
```
rather:
```
$ cargo run
```
the server will restart automatically 😀.