https://github.com/perfectlysoft/perfectapptemplate
Provides a structure for a larger project to grow into. It contains an HTTP Server config that loads from pre-separated Filters and Routes, a JSON config loader, and directories into which you can organize your handlers, objects and utility functions.
https://github.com/perfectlysoft/perfectapptemplate
server-side-swift swift
Last synced: 8 months ago
JSON representation
Provides a structure for a larger project to grow into. It contains an HTTP Server config that loads from pre-separated Filters and Routes, a JSON config loader, and directories into which you can organize your handlers, objects and utility functions.
- Host: GitHub
- URL: https://github.com/perfectlysoft/perfectapptemplate
- Owner: PerfectlySoft
- License: apache-2.0
- Created: 2017-02-20T23:38:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-12T18:09:34.000Z (almost 8 years ago)
- Last Synced: 2025-10-07T02:05:58.451Z (9 months ago)
- Topics: server-side-swift, swift
- Language: Swift
- Homepage: http://www.perfect.org
- Size: 71.3 KB
- Stars: 22
- Watchers: 3
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Perfect App Template
## Perfect App Template Starter Project
This repository holds a template 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.
The concept behind this template is to provide a structure for a larger project to grow into. It contains an HTTP Server config that loads from pre-separated Filters and Routes, a JSON config loader, and directories into which you can organize your handlers, objects and utility functions.
## Compatibility with Swift
The master branch of this project currently compiles with **Xcode 8.2** or the **Swift 3.0.2** 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/PerfectAppTemplate.git
cd PerfectAppTemplate
swift build
.build/debug/Perfect-App-Template
```
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://localhost:8181/) to see the greeting. Hit control-c to terminate the server.
## Starter Content
The template contains the following directories:
#### config
The config directory contains 2wo files `ApplicationConfiguration.json` and `ApplicationConfigurationLinux.json`. Add configuration options to these files and add them to be read and assigned in the `config()` function in `config/Config.swift`
#### webroot
This is for static files and Mustache template files.
### Source
#### Perfect-App-Template / configuration
The files in this directory are meant to drive configuration of your application. Add configuration options, filters, and routes here.
#### Perfect-App-Template / handlers
The files in this directory are handler functions for JSON and Web routes.
#### Perfect-App-Template / objects
This directory is intended as the location for where you place your object classes and structs. Tere is also an `initializeObjects.swift` file for invoking setup functions in one convenient place.
#### Perfect-App-Template / utility
Place utility and helper functions here.
## Further Information
For more information on the Perfect project, please visit [perfect.org](http://perfect.org).