{"id":22326497,"url":"https://github.com/thecodesmith/mock-api","last_synced_at":"2025-03-26T06:12:49.023Z","repository":{"id":84776801,"uuid":"103317960","full_name":"thecodesmith/mock-api","owner":"thecodesmith","description":"A simple REST API for creating mock REST APIs","archived":false,"fork":false,"pushed_at":"2017-09-12T20:37:06.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T07:32:46.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Groovy","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/thecodesmith.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":"2017-09-12T20:35:20.000Z","updated_at":"2017-09-12T20:35:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"f60fae36-5db0-45af-813e-e05079cc73a5","html_url":"https://github.com/thecodesmith/mock-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/thecodesmith%2Fmock-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodesmith%2Fmock-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodesmith%2Fmock-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodesmith%2Fmock-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodesmith","download_url":"https://codeload.github.com/thecodesmith/mock-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598317,"owners_count":20641884,"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-12-04T02:17:54.908Z","updated_at":"2025-03-26T06:12:49.018Z","avatar_url":"https://github.com/thecodesmith.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mock REST Server\n\n## API\n\n### Endpoints\n\n    GET     /api/routes\n    POST    /api/routes\n    GET     /api/routes/:id\n    PUT     /api/routes/:id\n    DELETE  /api/routes/:id\n\n### Route Data\n\n    route:\n      name: foo\n      method: get\n      status: 200\n      path: /foo/bar\n      active: true\n      content-type: application/json\n      body-content: '{\"foo\":\"bar\"}'\n      headers:\n        - X-Source-Server: mock\n        - X-Meta-Tags: foo bar\n\n### Examples\n\nHere is the minimum required to created a route (`name` and `path` must be\nspecified):\n\n    curl localhost:5050/api/routes \\\n            -X POST \\\n            -d '{\"name\": \"foo\", \"path\": \"foo\"}' \\\n            -H 'Content-Type: application/json'\n    {\"id\":1}\n\nGet definition of an existing route:\n\n    curl localhost:5050/api/routes/1\n    {\n        \"id\":1,\n        \"name\":\"foo\",\n        \"method\":\"GET\",\n        \"status\":200,\n        \"path\":\"api/foo\",\n        \"active\":1,\n        \"content_type\":\"application/json\",\n        \"body_content\":\"\"\n    }\n\nGet list of all routes:\n\n    curl localhost:5050/api/routes\n\nUpdate an existing route:\n\n    curl localhost:5050/api/routes/1 -X PUT -d '{\"status\": 404}'\n\nDelete a route:\n\n    curl localhost:5050/api/routes/1 -X DELETE\n\n\n## Deploy\n\n### Build the Docker image\n\nBuild the docker image:\n\n    ./gradlew buildDockerImage\n\nThis builds an image named `thecodesmith/mock-api`.\n\n### Run the container\n\n    docker run -p 5050:5050 -it thecodesmith/mock-api\n\nThe app runs on port `5050` inside the container, and can be bound to any\ndesired port.\n\n### Persist data between restarts\n\nThe app writes its data to the `/web/data` directory inside the container.\nThe container's filesystem is ephemeral, and will disappear when the container\nis stopped. To persist data between restarts, mount a host volume when starting\nthe container, like this:\n\n    mkdir data\n    docker run -p 5050:5050 -v $(pwd)/data:/web/data -it thecodesmith/mock-api\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodesmith%2Fmock-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodesmith%2Fmock-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodesmith%2Fmock-api/lists"}