This project demonstrates the integration Stormpath's Turnstile authentication system with Perfect and a PostgreSQL ORM.
Swift HTML CSS Shell
Latest commit 631920a Jan 13, 2017 @iamjono iamjono update logging dep

README.md

Perfect Turnstile with PostgreSQL

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 3.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

This example demonstrates the integration Stormpath's Turnstile authentication system with Perfect and a PostgreSQL ORM.

The library can be found at https://github.com/PerfectlySoft/Perfect-Turnstile-PostgreSQL

This package builds with Swift Package Manager and is part of the Perfect project.

Ensure you have installed Xcode 8.0 or later.

Build Notes

macOS

If you receive a compile error that says the following, you need to install and link libxml2

note: you may be able to install libxml-2.0 using your system-packager:

    brew install libxml2

Compile Swift Module 'PerfectXML' (2 sources)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "libxml2.h"

To install and link libxml2 with homebrew, use the following two commands

brew install libxml2
brew link --force libxml2

To install Postgres:

brew install postgres

Linux

Ensure that you have installed libxml2-dev and pkg-config.

sudo apt-get install libxml2-dev pkg-config

To install libpq-dev

sudo apt-get install libpq-dev

Setup - Xcode 8

  • Check out or download the project;
  • In terminal, navigate to the directory and execute
swift package generate-xcodeproj
  • Open PerfectTurnstilePostgreSQLDemo.xcodeproj

To run this project from Xcode, edit the Scheme, Under "Options" for "run", check "Use custom working directory" and choose the project's working directory. After doing this, the project can be run from within Xcode.

Setup - Terminal

  • Check out or download the project;
  • In terminal, navigate to the directory
  • Execute swift build
  • Once the project has compiled, execute ./.build/debug/PerfectTurnstilePostgreSQLDemo
[INFO] Starting HTTP server on 0.0.0.0:8181 with document root ./webroot

Included JSON Routes

The framework includes certain basic routes:

POST /api/v1/login (with username & password form elements)
POST /api/v1/register (with username & password form elements)
GET /api/v1/logout

Included Routes for Browser

The following routes are available for browser testing:

http://localhost:8181
http://localhost:8181/login
http://localhost:8181/register

These routes are using Mustache files in the webroot directory.