https://github.com/willguimont/simple_rust_api
https://github.com/willguimont/simple_rust_api
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/willguimont/simple_rust_api
- Owner: willGuimont
- License: mit
- Created: 2023-06-20T11:53:54.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-28T01:24:49.000Z (about 2 years ago)
- Last Synced: 2025-04-05T03:02:45.140Z (over 1 year ago)
- Language: Rust
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust_api
## Run
```shell
docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 --rm -d postgres
echo DATABASE_URL=postgres://postgres:postgres@localhost/rust_api > .env
diesel setup
diesel migration run
cargo run
```
or use docker-compose
```shell
docker-compose up --build
```
## Query
```shell
# Create document
curl -X POST -H "Content-Type: application/json" -d '{"title": "Attention is all you need", "url": "https://arxiv.org/abs/1706.03762"}' http://localhost:8081/documents
# Query all documents
curl http://localhost:8081/documents
```