Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tr1sm0s1n/axum-mongo-api
Axum API for CRUD operations in MongoDB.
https://github.com/tr1sm0s1n/axum-mongo-api
api axum crud docker mongodb rest rust tokio
Last synced: about 1 month ago
JSON representation
Axum API for CRUD operations in MongoDB.
- Host: GitHub
- URL: https://github.com/tr1sm0s1n/axum-mongo-api
- Owner: tr1sm0s1n
- License: mit
- Created: 2024-01-19T04:52:42.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-23T11:36:43.000Z (11 months ago)
- Last Synced: 2024-02-23T12:39:17.308Z (11 months ago)
- Topics: api, axum, crud, docker, mongodb, rest, rust, tokio
- Language: Rust
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Axum-Mongo-API
Axum API for CRUD operations in MongoDB.
## 🛠 Built With
[![Rust Badge](https://img.shields.io/badge/Rust-000?logo=rust&logoColor=fff&style=for-the-badge)](https://www.rust-lang.org/)
[![Axum Badge](https://img.shields.io/badge/Axum-000?logo=rust&logoColor=fff&style=for-the-badge)](https://docs.rs/axum/latest/axum/)
[![MongoDB Badge](https://img.shields.io/badge/MongoDB-47A248?logo=mongodb&logoColor=fff&style=for-the-badge)](https://www.mongodb.com/)
[![Docker Badge](https://img.shields.io/badge/Docker-2496ED?logo=docker&logoColor=fff&style=for-the-badge)](https://www.docker.com/)## ⚙️ Run Locally
Clone the project
```bash
git clone https://github.com/tr1sm0s1n/axum-mongo-api.git
cd axum-mongo-api
```Install Rust
```bash
make install
```Start the database
```bash
make up
```Run the application
```bash
make run
```Create a certificate
```bash
curl -X POST http://127.0.0.1:8080/create -H "Content-Type: application/json" -d '{"_id": 1, "name": "Langley", "course": "9A"}'
```Read all certificates
```bash
curl http://127.0.0.1:8080/read
```Read a certificate
```bash
curl http://127.0.0.1:8080/read/1
```Update a certificate
```bash
curl -X PUT http://127.0.0.1:8080/update/1 -H "Content-Type: application/json" -d '{"_id": 1, "name": "Nightingale", "course": "MBCC"}'
```Delete a certificate
```bash
curl -X DELETE http://127.0.0.1:8080/delete/1
```View the database (optional)
```bash
make enter
```Stop the database
```bash
make down
```