# PerfectTemplate **Repository Path**: sr_lele/PerfectTemplate ## Basic Information - **Project Name**: PerfectTemplate - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-08-26 - **Last Updated**: 2024-06-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PerfectTemplate [简体中文](README.zh_CN.md)
Perfect Empty Starter Project This 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. ## Compatibility with Swift The master branch of this project currently compiles with **Xcode 10** and the **Swift 4.1** or higher toolchain on Ubuntu. ## Building & Running The following will clone and build an empty starter project and launch the server on port 8181. ``` git clone https://github.com/PerfectlySoft/PerfectTemplate.git cd PerfectTemplate swift run ``` You should see the following output: ``` [INFO] Starting HTTP server localhost on 0.0.0.0:8181 ``` This 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. ## Starter Content The template file contains a simple "hello, world!" request handler and shows how to serve static files, and compress outgoing content. ```swift import PerfectHTTP import PerfectHTTPServer // An example request handler. // This 'handler' function can be referenced directly in the configuration below. func handler(request: HTTPRequest, response: HTTPResponse) { // Respond with a simple message. response.setHeader(.contentType, value: "text/html") response.appendBody(string: "