{"id":20692633,"url":"https://github.com/kevingimbel/srvc","last_synced_at":"2026-05-05T00:35:14.090Z","repository":{"id":64307483,"uuid":"118608084","full_name":"KevinGimbel/srvc","owner":"KevinGimbel","description":"Quick API / service prototyping tool","archived":false,"fork":false,"pushed_at":"2018-01-24T08:13:24.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T17:35:15.130Z","etag":null,"topics":["api","development","fakeapi","golang","linux","macos","mock-api","prototyping","windows"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KevinGimbel.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}},"created_at":"2018-01-23T12:33:50.000Z","updated_at":"2020-01-09T09:15:29.000Z","dependencies_parsed_at":"2023-01-15T11:00:41.092Z","dependency_job_id":null,"html_url":"https://github.com/KevinGimbel/srvc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Fsrvc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Fsrvc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Fsrvc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinGimbel%2Fsrvc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevinGimbel","download_url":"https://codeload.github.com/KevinGimbel/srvc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242956547,"owners_count":20212454,"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":["api","development","fakeapi","golang","linux","macos","mock-api","prototyping","windows"],"created_at":"2024-11-16T23:23:14.050Z","updated_at":"2026-05-05T00:35:14.041Z","avatar_url":"https://github.com/KevinGimbel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `srvc`\n\n`srvc` is a command line tool which allows you to quickly spin up a webserver with configurable routes. These routes can be configured to return HTML pages, XML, JSON, other files, custom headers, and inline-content directly from the config file.\n\n## How to install\n\n### Homebrew\n\nOn MacOS you can get the latest version from `brew`.\n\n```sh\n$ brew install kevingimbel/tap/srvc\n```\n\n### Binary\n\nAlternatively you can grab the latest binary from the [releases page](https://github.com/kevingimbel/srvc/releases) and place it somewhere in your `$PATH` (e.g. `/usr/local/bin/`).\n\n## Usage\n\n```sh\n$ srvc\n$ srvc [-port 1313]\n```\n\n`-port` is optional and takes a HTTP port to serve to. The default port is 8080.\n\n## Config\n\n`srvc` needs a YAML configuration file in the directory it is executed in. See the sample configuration file in the [example](/example/) directory.\n\nThe same configuration file is shown below.\n\n```yaml\n# global header config, added to each route\nheaders:\n  - key: \"client\"\n    value: \"srvc-alpha1\"\n\n# route based config\nroutes:\n# For the route \"/demo/html-page\" display the \"index.html\" file from the \"html\" fodler\n  /demo/html-page:\n    headers:\n      - key: \"Content-Type\"\n        value: \"text/html\"\n    file: \"./html/index.html\"\n\n  # display HTML content defined inline for /demo/html-inline\n  /demo/html-inline:\n    headers:\n      - key: \"Content-Type\"\n        value: \"text/html\"\n    content: |\n      \u003ch1\u003eIt works!\u003c/h1\u003e\n      \u003cp\u003eThe content is defined inside the srvc.yaml config file\n\n  # Display XML on /demo/xml\n  /demo/xml:\n    headers:\n      - key: \"Content-Type\"\n        value: \"application/xml\"\n    content: |\n      \u003cnode id=\"12\"\u003e\n        \u003cmeta charset=\"utf-8\" /\u003e\n        \u003clink to=\"#sub\" lang=\"en\"\u003e\n          \u003ctitle\u003eGo to sub\u003c/title\u003e\n          \u003ctext\u003eClick here\u003c/text\u003e\n        \u003c/link\u003e\n      \u003c/node\u003e\n\n  # \"json/from-file\" returns the content of a JSON file\n  /json/from-file:\n    headers:\n      - key: \"Content-Type\"\n        value: \"application/json\"\n    file: \"./json/from-file/dirty.json\"\n```\n\n### Headers\n\nHeader can be defined on a global level or for each route. The global headers are added to each route, in the above example each route gets a `\"client\": \"srvc-alpha1\"` header.\n\n```yaml\nheaders:\n    - key: \"client\"\n      value: \"srvc-alpha1\"\n```\n\n### Routes\n\nRoutes make up the second global config object. Here the different routes are defined. The \"key\" for each nested object is the route, for example \"/hello/world\" which makes `srvc` respond on `localhost:8080/hello/world`.\n\n```yaml\nroutes:\n    /hello/world:\n        headers:\n            - key: \"custom\"\n              value: \"header for route /hello/world\"      \n            - key: \"Content-Type\"\n                value: \"text/html\"\n        content: |\n            \u003ch1\u003eHello, world!\u003c/h1\u003e\n            \u003cp\u003eThis is inline content!\u003c/p\u003e\n```\n\nThis route will respond with a HTML page containing the following code.\n\n```html\n\u003ch1\u003eHello, world!\u003c/h1\u003e\n\u003cp\u003eThis is inline content!\u003c/p\u003e\n```\n\nA route can be configured to respond with the content of a file, as shown below.\n\n```html\nroutes:\n    /hello/world/file:\n        headers:\n            - key: \"custom\"\n              value: \"header for route /hello/world\"      \n            - key: \"Content-Type\"\n                value: \"text/html\"\n        file: \"./relative/path/to/file.html\"\n```\n\nThe route `/hello/world/file` now responds with the contents of the file located at `./relative/path/to/file.html`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingimbel%2Fsrvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevingimbel%2Fsrvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingimbel%2Fsrvc/lists"}