{"id":17999742,"url":"https://github.com/neoneye/swiftyserverrouter-demo","last_synced_at":"2025-03-26T06:31:44.885Z","repository":{"id":136502295,"uuid":"138197920","full_name":"neoneye/SwiftyServerRouter-Demo","owner":"neoneye","description":"Proof of concept generating documentation for all endpoints","archived":false,"fork":false,"pushed_at":"2018-06-23T14:57:08.000Z","size":15,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T09:35:21.551Z","etag":null,"topics":["perfect-server","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/neoneye.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-21T16:50:00.000Z","updated_at":"2024-03-24T14:10:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"815fee49-1e51-40db-b5da-4715a53adf1a","html_url":"https://github.com/neoneye/SwiftyServerRouter-Demo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyServerRouter-Demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyServerRouter-Demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyServerRouter-Demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyServerRouter-Demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoneye","download_url":"https://codeload.github.com/neoneye/SwiftyServerRouter-Demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245603849,"owners_count":20642895,"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":["perfect-server","swift"],"created_at":"2024-10-29T22:14:35.412Z","updated_at":"2025-03-26T06:31:44.879Z","avatar_url":"https://github.com/neoneye.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftyServerRouter-Demo\n\nThis is an example project for the [SwiftyServerRouter](https://github.com/neoneye/SwiftyServerRouter) framework, that shows how to generate documentation for all endpoints.\n\n## This is what the resulting documentation looks like\n\n![All the endpoints listed in a table](https://i.imgur.com/BbWAjZF.png)\n\n## How to build the routes\n\nThere is a route for documentation: http://localhost:8181/docs\n\n```swift\ndo {\n    let handler = PerfectHTTPServer.HTTPHandler.staticFiles\n    let route = \"/**\"\n    let purpose = \"Serve static files\"\n    let data: [String:Any] = [\n        \"allowResponseFilters\": true\n    ]\n    perfect_endpoint(method: .get, route: route, purpose: purpose, data: data, handler: handler)\n    perfect_endpoint(method: .head, route: route, purpose: purpose, data: data, handler: handler)\n}\n\nget(\"/healthcheck\", EP_GetHealthcheck.self)\nget(\"/docs\", EP_GetEndpointDocumentation.self)\nscope(\"/v1\") {\n    get   (\"/debug\", EP_Debug.self)\n    post  (\"/debug\", EP_Debug.self)\n    put   (\"/debug\", EP_Debug.self)\n    delete(\"/debug\", EP_Debug.self)\n}\n```\n\n## How to create an endpoint\n\n```swift\nimport SwiftyServerRouter\n\nclass EP_GetHealthcheck: Endpoint {\n    required init() {}\n\n    let purpose = \"Used for healthcheck functionality for monitors and load balancers\"\n\n    func handler(context: HandlerContext) throws {\n        let _ = try? context.response.setBody(json: [\"health\": \"ok\"])\n        context.response.completed()\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoneye%2Fswiftyserverrouter-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneoneye%2Fswiftyserverrouter-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoneye%2Fswiftyserverrouter-demo/lists"}