Swiftpack.co - Package - mrfishball/Swerver

Swerver

Build Status

A HTTP Server in Swift.

Public URL: http://52.24.199.245:5000

Prerequisites

  • Swift 4 (For Linux only. If you're on OS X, Swift is bundled with Xcode)

  • Latest Xcode (For OSX only)

  • Any modern web browser / Postman / Paw or curl commands

  • Terminal

  • Ruby (For running acceptance tests)

Set Up

Clone or fork this repo:

$ git clone https://github.com/mrfishball/Swerver.git

CD into the repo directory and pull the submodule:

git submodule init
git submodule update

To be able to open and edit in Xcode, in the root of the project directory, run:

$ swift package generate-xcodeproj

Running and testing Swerver in Xcode (Shortcut Keys)

In Xcode, go to 'Product', then 'Scheme' and make sure there's a checkmark next to Swerver-Package, then click on 'Edit Scheme...'. Now a window will pop up and on the left menu bar, select 'Run' then next to 'Executable' on the right plane select 'SwerverRunner'. Hit close. Follow the instruction below to run Swerver.

To run:

Command + R

To unit test:

Command + U

To stop Swerver:

Command + .

Compiling, testing and running Swerver with the Swift Package Manager

To build, run:

$ swift build

And to test, run:

$ swift test

Finally to run:

$ swift run

Acceptance Tests (Only if you are not using Xcode. See above for more detail on running in Xcode)

Inside the submodule directory (http_server_spec) run:

bundle install

then run:

bundle exec spinach --tags ~@simple-post

to run all relevant tests

Running and testing Swerver in the docker container

To Build a Linux environment with Swift, cd into the project directory and run:

docker build -t swerver:latest .

Docker will test and build the project into a docker image.

After successfully building a docker image, run in the terminal:

docker run -p 5000:5000 swerver:latest

Swerver(docker) will now be running. Point to localhost:5000 to access it.

Deploying to AWS ECS (Requires AWS account and Docker)

Docker

Setting Up with Amazon ECS

Getting started with Amazon ECS

For example deploy procedure, see Scripts/deploy.sh

Usage

Following the instructions in the terminal after running the server.

Author

Steven Kwok (@mrfishball)

License

TTT is released under the MIT License. See the LICENSE file for further details.

Github

link
Stars: 0
Help us keep the lights on

Used By

Total: 0