{"id":18720450,"url":"https://github.com/stiffstream/restinio-crud-example","last_synced_at":"2025-04-12T14:14:55.855Z","repository":{"id":109496900,"uuid":"213304945","full_name":"Stiffstream/restinio-crud-example","owner":"Stiffstream","description":"It is a simple example of CRUD application based on RESTinio library","archived":false,"fork":false,"pushed_at":"2023-12-13T12:26:01.000Z","size":21,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T08:51:36.414Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stiffstream.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-10-07T05:48:53.000Z","updated_at":"2024-04-12T21:32:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7a7dfca-8630-4160-a5ad-3171dcdf9362","html_url":"https://github.com/Stiffstream/restinio-crud-example","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/Stiffstream%2Frestinio-crud-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stiffstream%2Frestinio-crud-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stiffstream%2Frestinio-crud-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stiffstream%2Frestinio-crud-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stiffstream","download_url":"https://codeload.github.com/Stiffstream/restinio-crud-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578824,"owners_count":21127713,"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-07T13:31:08.028Z","updated_at":"2025-04-12T14:14:55.834Z","avatar_url":"https://github.com/Stiffstream.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# restinio-crud-example\n\nrestinio-crud-example is a simple example of CRUD application based on\n[RESTinio](https://github.com/stiffstream/restinio) library.\n\n# How to obtain and build\n\n## Prerequisites\n\nrestinio-crud-example requires C++ compiler with C++14 support, vcpkg and CMake.\n\n## Obtaining\n\nJust clone restinio-crud-example from GitHub:\n\n```sh\ngit clone https://github.com/stiffstream/restinio-crud-example\ncd restinio-crud-example\n```\n\n## Building\n\n### Obtaining the dependencies\n\nrestinio-crud-example uses the following libraries directly: RESTinio, json_dto, SQLiteCpp and optional-lite. Those libraries also use RapidJson, fmtlib and sqlite3. All those dependencies should be obtained via vcpkg:\n\n```sh\nvcpkg install restinio json-dto sqlitecpp optional-lite\n```\n\n### Building\n\nThe build of restinio-crud-example is performed via CMake. Please note the usage of vcpkg's toolchain file:\n\n```sh\ncd restinio-crud-example\nmkdir cmake_build\ncd cmake_build\ncmake -DCMAKE_TOOLCHAIN_FILE=\u003cpath-to-your-vcpkg\u003e/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release .\ncmake --build .\n```\n\n# Running\n\nJust launch `crud_example` executable. The DB file (`pets.db3`) will be created in the current path.\n\n## A brief reminder of how to try\n\nTo create a new pet in the DB prepare a .json file like that:\n\n```js\n{\"name\":\"Bunny\", \"type\":\"dog\", \"owner\":\"John Smith\", \"picture\":\"bunny.jpg\"}\n```\n\nthen issue the following command:\n\n```sh\ncurl -d @new_pet.json -H \"Content-Type: application/json\" -X POST http://localhost:8080/all/v1/pets\n```\n\nTo query a particular pet just issue the following command:\n\n```sh\ncurl http://localhost:8080/all/v1/pets/\u003cID\u003e\n```\nWhere `ID` is a numeric identity of pet to retrive. For example:\n```sh\ncurl http://localhost:8080/all/v1/pets/2\n```\n\nTo query info about all pets in the database:\n\n```sh\ncurl http://localhost:8080/all/v1/pets\n```\n\nTo change the info about a particular pet prepare a .json file (the same way as for a new pet) and issue the following command:\n```sh\ncurl -d @new_pet.json -H \"Content-Type: application/json\" -X PATCH http://localhost:8080/all/v1/pets/\u003cID\u003e\n```\nWhere `ID` is a numeric identity of pet to update.\n\nTo remove a particular pet from the DB issue the following command:\n```sh\ncurl -X DELETE http://localhost:8080/all/v1/pets/\u003cID\u003e\n```\nWhere `ID` is a numeric identity of pet to remove.\n\nTo create a bunch of pets at once it is necessary to prepare a .json file like that:\n```js\n{\"pets\": [\n    {\"name\":\"Bunny\", \"type\":\"dog\", \"owner\":\"John Smith\", \"picture\":\"bunny.jpg\"}\n    ,{\"name\":\"Baff\", \"type\":\"dog\", \"owner\":\"John Smith\", \"picture\":\"baff.jpg\"}\n    ,{\"name\":\"Princess\", \"type\":\"cat\", \"owner\":\"John Smith\", \"picture\":\"princess.jpg\"}\n  ]\n}\n```\nThen access the URL `http://localhost:8080/all/v1/pets/batch-upload-form` in a brawser: a form for selection of .json file will be returned. The .json file should be selected and submitted to the server by hitting \"Submit\" button on that form. New pets would be created and JSON like that will be returned in the response:\n```js\n{\"ids\":[7,8,9]}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstiffstream%2Frestinio-crud-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstiffstream%2Frestinio-crud-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstiffstream%2Frestinio-crud-example/lists"}