{"id":13582361,"url":"https://github.com/rif/spark","last_synced_at":"2025-12-26T14:18:02.443Z","repository":{"id":14035876,"uuid":"16738241","full_name":"rif/spark","owner":"rif","description":"Emergency web server","archived":false,"fork":false,"pushed_at":"2021-12-17T15:00:51.000Z","size":6510,"stargazers_count":608,"open_issues_count":1,"forks_count":42,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-04-20T16:59:53.718Z","etag":null,"topics":[],"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/rif.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":"2014-02-11T17:07:39.000Z","updated_at":"2024-04-19T21:56:17.000Z","dependencies_parsed_at":"2022-09-26T20:00:45.197Z","dependency_job_id":null,"html_url":"https://github.com/rif/spark","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/rif/spark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rif%2Fspark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rif%2Fspark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rif%2Fspark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rif%2Fspark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rif","download_url":"https://codeload.github.com/rif/spark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rif%2Fspark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28055966,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-08-01T15:02:38.544Z","updated_at":"2025-12-26T14:18:02.437Z","avatar_url":"https://github.com/rif.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# spark\n\nEmergency web server\n\nFor those occasions when your webserver is down and you want to display a quick maintainance note. Or just want to quickly demo a static site. Or whatever :)\n\nIt can take a directory, a file or directly the body string. The `-proxy` flag can be useful when used as a development server.\n\n\n```\n❯ spark -h\nUsage of spark:\n  -address string\n    \tListening address (default \"0.0.0.0\")\n  -cert string\n    \tSSL certificate path (default \"cert.pem\")\n  -contentType string\n    \tSet response Content-Type\n  -corsHeaders string\n    \tAllowed CORS headers (default \"Content-Type, Authorization, X-Requested-With\")\n  -corsMethods string\n    \tAllowed CORS methods (default \"POST, GET, OPTIONS, PUT, DELETE\")\n  -corsOrigin string\n    \tAllow CORS requests from this origin (can be '*')\n  -deny string\n    \tSensitive directory or file patterns to be denied when serving directory (comma separated)\n  -key string\n    \tSSL private Key path (default \"key.pem\")\n  -mock string\n    \tDirectory containing mock responses\n  -path string\n    \tURL path (default \"/\")\n  -port string\n    \tListening port (default \"8080\")\n  -proxy string\n    \tURL prefixes to be proxied to another server e.g. /api=\u003ehttp://localhost:3000 will forward all requests starting with /api to http://localhost:3000 (comma separated)\n  -sslPort string\n    \tSSL listening port (default \"10433\")\n  -status int\n    \tReturned HTTP status code (default 200)\n  -version\n    \tprints current version\n```\n\n## install\n- from source\n```\ngo get github.com/rif/spark\n```\n- static binaries (linux/arm/osx/windows):\n  \u003ca href=\"https://github.com/rif/spark/releases\" target=\"_blank\"\u003eBinary downloads\u003c/a\u003e\n\n## examples\n\n```\n$ spark message.html\n$ spark \"\u003ch1\u003eOut of order\u003c/h1\u003e\u003cp\u003eWorking on it...\u003c/p\u003e\"\n$ spark static_site/\n$ spark -port 80 -sslPort 443 \"\u003ch1\u003eOoops!\u003c/h1\u003e\"\n$ spark -deny \".git*,LICENSE\" ~/go/rif/spark\n$ spark -proxy \"/api=\u003ehttp://localhost:9090/api\" .\n$ spark -port 9000 -corsOrigin \"https://www.mydomain.com\" -contentType \"application/json\" '{\"message\":\"Hello\"}'\n```\n\n## new features\n\n### echo endpoint\nThe `/echo` endpoint returns request details (method, headers, body) for debugging:\n```\n$ spark \"Hello\" \u0026\n$ curl -X POST http://localhost:8080/echo -d '{\"test\": \"data\"}'\n```\n\n### mock server\nCreate mock API responses using directory structure:\n```\n# Directory structure defines endpoints\nmock/\n  users/\n    GET              # responds to GET /users\n    POST_201         # responds to POST /users with 201 status\n  api/\n    products/\n      GET            # responds to GET /api/products\n\n# Start mock server\n$ spark -mock mock/\n\n# Test endpoints\n$ curl http://localhost:8080/users\n$ curl -X POST http://localhost:8080/users\n```\n\nFiles are named after HTTP verbs (case-insensitive). Add `_STATUS` suffix for custom status codes (e.g., `POST_201`, `DELETE_204`). Returns 405 Method Not Allowed for unsupported methods.\n\n## ssl certificate\n\nTo quickly generate a ssl certificate run:\n\n```\ngo run $GOROOT/src/crypto/tls/generate_cert.go --host=\"localhost\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frif%2Fspark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frif%2Fspark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frif%2Fspark/lists"}