{"id":20038005,"url":"https://github.com/perfectlysoft/perfecttemplate","last_synced_at":"2025-04-10T00:18:34.294Z","repository":{"id":46764707,"uuid":"56724967","full_name":"PerfectlySoft/PerfectTemplate","owner":"PerfectlySoft","description":"Empty Perfect Starter Project.","archived":false,"fork":false,"pushed_at":"2019-05-10T01:50:34.000Z","size":62,"stargazers_count":222,"open_issues_count":13,"forks_count":84,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-10T00:18:29.635Z","etag":null,"topics":["http","http-server","server-side-swift","swift"],"latest_commit_sha":null,"homepage":"https://www.perfect.org","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PerfectlySoft.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":"2016-04-20T22:25:39.000Z","updated_at":"2025-03-03T09:53:07.000Z","dependencies_parsed_at":"2022-09-23T03:52:26.461Z","dependency_job_id":null,"html_url":"https://github.com/PerfectlySoft/PerfectTemplate","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/PerfectlySoft%2FPerfectTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfectTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfectTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfectTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerfectlySoft","download_url":"https://codeload.github.com/PerfectlySoft/PerfectTemplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131318,"owners_count":21052820,"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":["http","http-server","server-side-swift","swift"],"created_at":"2024-11-13T10:24:37.587Z","updated_at":"2025-04-10T00:18:34.278Z","avatar_url":"https://github.com/PerfectlySoft.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PerfectTemplate [简体中文](README.zh_CN.md)\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://perfect.org/get-involved.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.org/assets/github/perfect_github_2_0_0.jpg\" alt=\"Get Involed with Perfect!\" width=\"854\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/PerfectlySoft/Perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_1_Star.jpg\" alt=\"Star Perfect On Github\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"http://stackoverflow.com/questions/tagged/perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/perfect_gh_button_2_SO.jpg\" alt=\"Stack Overflow\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"https://twitter.com/perfectlysoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_3_twit.jpg\" alt=\"Follow Perfect on Twitter\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_4_slack.jpg\" alt=\"Join the Perfect Slack\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat\" alt=\"Swift 5.0\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Platforms-macOS%20%7C%20Linux%20-lightgray.svg?style=flat\" alt=\"Platforms macOS | Linux\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.org/licensing.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache-lightgrey.svg?style=flat\" alt=\"License Apache\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://twitter.com/PerfectlySoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Twitter-@PerfectlySoft-blue.svg?style=flat\" alt=\"PerfectlySoft Twitter\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.ly/badge.svg\" alt=\"Slack Status\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nPerfect Empty Starter Project\n\nThis repository holds a blank Perfect project which can be cloned to serve as a starter for new work. It builds with Swift Package Manager and produces a stand-alone HTTP executable.\n\n## Compatibility with Swift\n\nThe master branch of this project currently compiles with **Xcode 10** and the **Swift 4.1** or higher toolchain on Ubuntu.\n\n## Building \u0026 Running\n\nThe following will clone and build an empty starter project and launch the server on port 8181.\n\n```\ngit clone https://github.com/PerfectlySoft/PerfectTemplate.git\ncd PerfectTemplate\nswift run\n```\n\nYou should see the following output:\n\n```\n[INFO] Starting HTTP server localhost on 0.0.0.0:8181\n```\n\nThis means the server is running and waiting for connections. Access [http://localhost:8181/](http://127.0.0.1:8181/) to see the greeting. Hit control-c to terminate the server.\n\n## Starter Content\n\nThe template file contains a simple \"hello, world!\" request handler and shows how to serve static files, and compress outgoing content.\n\n```swift\nimport PerfectHTTP\nimport PerfectHTTPServer\n\n// An example request handler.\n// This 'handler' function can be referenced directly in the configuration below.\nfunc handler(request: HTTPRequest, response: HTTPResponse) {\n\t// Respond with a simple message.\n\tresponse.setHeader(.contentType, value: \"text/html\")\n\tresponse.appendBody(string: \"\u003chtml\u003e\u003ctitle\u003eHello, world!\u003c/title\u003e\u003cbody\u003eHello, world!\u003c/body\u003e\u003c/html\u003e\")\n\t// Ensure that response.completed() is called when your processing is done.\n\tresponse.completed()\n}\n\n// Configure one server which:\n//\t* Serves the hello world message at \u003chost\u003e:\u003cport\u003e/\n//\t* Serves static files out of the \"./webroot\"\n//\t\tdirectory (which must be located in the current working directory).\n//\t* Performs content compression on outgoing data when appropriate.\nvar routes = Routes()\nroutes.add(method: .get, uri: \"/\", handler: handler)\nroutes.add(method: .get, uri: \"/**\",\n\t\t   handler: StaticFileHandler(documentRoot: \"./webroot\", allowResponseFilters: true).handleRequest)\ntry HTTPServer.launch(name: \"localhost\",\n\t\t\t\t\t  port: 8181,\n\t\t\t\t\t  routes: routes,\n\t\t\t\t\t  responseFilters: [\n\t\t\t\t\t\t(PerfectHTTPServer.HTTPFilter.contentCompression(data: [:]), HTTPFilterPriority.high)])\n\n```\n\n## Further Information\nFor more information on the Perfect project, please visit [perfect.org](http://perfect.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectlysoft%2Fperfecttemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperfectlysoft%2Fperfecttemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectlysoft%2Fperfecttemplate/lists"}