{"id":19273251,"url":"https://github.com/tranquangvu/rust-actix-sample-api","last_synced_at":"2025-02-23T20:42:15.552Z","repository":{"id":66256831,"uuid":"209459596","full_name":"tranquangvu/rust-actix-sample-api","owner":"tranquangvu","description":"Build simple API with actix framework","archived":false,"fork":false,"pushed_at":"2019-09-27T10:24:40.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-05T14:19:52.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tranquangvu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-19T04:04:18.000Z","updated_at":"2019-09-27T10:24:42.000Z","dependencies_parsed_at":"2023-02-20T18:45:44.363Z","dependency_job_id":null,"html_url":"https://github.com/tranquangvu/rust-actix-sample-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tranquangvu%2Frust-actix-sample-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tranquangvu%2Frust-actix-sample-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tranquangvu%2Frust-actix-sample-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tranquangvu%2Frust-actix-sample-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tranquangvu","download_url":"https://codeload.github.com/tranquangvu/rust-actix-sample-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240378874,"owners_count":19792039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T20:41:55.914Z","updated_at":"2025-02-23T20:42:15.520Z","avatar_url":"https://github.com/tranquangvu.png","language":"Rust","readme":"# Rust Sample API\nPractice rust language by building sample API by actix framework\n\n## Install\n* Make sure you have installed Rust\n  ```\n    curl https://sh.rustup.rs -sSf | sh\n    source $HOME/.cargo/env\n    export PATH=\"$HOME/.cargo/bin:$PATH\"\n  ```\n* Clone this source code\n* Add `.env` (Refer from `.env.example`)\n* Build app\n  ```\n    cargo build\n  ```\n* Setup `diesel_cli` and init database\n  ```\n    cargo install diesel_cli\n    diesel setup\n    diesel migration run\n  ```\n* Make some seed data\n  ```\n    psql -U postgres -d mystore -c \"INSERT INTO products(name, stock, price) VALUES ('shoes', 10.0, 100); INSERT INTO products(name, stock, price) VALUES ('hats', 5.0, 50);\"\n  ```\n* Start server\n  ```\n    cargo run\n  ```\n  Server run on `127.0.0.1:8000`\n* Example requests\n  - Get all products\n    ```\n      curl http://127.0.0.1:8000/products\n    ```\n  - Create products\n    ```\n      curl http://127.0.0.1:8000/products -H \"Content-Type: application/json\" -d '{\"name\": \"socks\", \"stock\": 7, \"price\": 2}'\n    ```\n  - Show product\n    ```\n      curl http://127.0.0.1:8000/products/1\n    ```\n  - Update product\n    ```\n      curl -X PATCH http://127.0.0.1:8000/products/1 -H \"Content-Type: application/json\" -d '{\"stock\": 8}'\n    ```\n  - Delete product\n    ```\n      curl -X DELETE http://127.0.0.1:8000/products/1 -H \"Content-Type: application/json\"\n    ```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftranquangvu%2Frust-actix-sample-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftranquangvu%2Frust-actix-sample-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftranquangvu%2Frust-actix-sample-api/lists"}