All Projects → PerfectlySoft → Perfect-HTTPServer

PerfectlySoft / Perfect-HTTPServer

Licence: Apache-2.0, Unknown licenses found Licenses found Apache-2.0 LICENSE Unknown LICENSE.zh_CN
HTTP server for Perfect.

Programming Languages

swift
15916 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Perfect-HTTPServer

Perfect-HTTP
Base HTTP Support for Perfect.
Stars: ✭ 29 (-72.12%)
Mutual labels:  perfect, server-side-swift, httpserver
Perfect-Authentication
OAuth2 Implementations with Facebook, Google, LinkedIn, Slack, SalesForce and GitHub providers.
Stars: ✭ 14 (-86.54%)
Mutual labels:  perfect, server-side-swift
Perfect-Thread
Core threading library for Perfect Server Side Swift. Includes support for serial and concurrent thread queues, locks, read/write locks and events.
Stars: ✭ 17 (-83.65%)
Mutual labels:  perfect, server-side-swift
Perfect
Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)
Stars: ✭ 13,890 (+13255.77%)
Mutual labels:  perfect, server-side-swift
Perfect-JSON-API
An Example JSON API for Perfect
Stars: ✭ 43 (-58.65%)
Mutual labels:  perfect, server-side-swift
SwiftString
A comprehensive, lightweight string extension for Swift 3.x & 4.0
Stars: ✭ 117 (+12.5%)
Mutual labels:  perfect, server-side-swift
Perfect-Weather
Demonstrate using URL Routes & variables, Fetching of remote data from API's as JSON, reading and transforming to data more appropriately consumable by an API client.
Stars: ✭ 32 (-69.23%)
Mutual labels:  perfect, server-side-swift
Perfect-Zip
Perfect Zip compression utility.
Stars: ✭ 20 (-80.77%)
Mutual labels:  perfect, server-side-swift
Perfect-WebSocketsServer
Perfect Example Module: WebSockets Server
Stars: ✭ 34 (-67.31%)
Mutual labels:  perfect, server-side-swift
Perfect-URLRouting
Perfect Example Module: URL Routing
Stars: ✭ 20 (-80.77%)
Mutual labels:  perfect, server-side-swift
Perfect-XML
XML support for Perfect.
Stars: ✭ 16 (-84.62%)
Mutual labels:  perfect, server-side-swift
Perfect-URL-Shortener
An Example URL Shortener System for Perfect
Stars: ✭ 37 (-64.42%)
Mutual labels:  perfect, server-side-swift
Kitura-NIO
A networking library for Kitura, based on SwiftNIO
Stars: ✭ 35 (-66.35%)
Mutual labels:  server-side-swift, httpserver
Perfect-SMTP
SMTP Client for Perfect.
Stars: ✭ 19 (-81.73%)
Mutual labels:  perfect, server-side-swift
HomeKitty
A Vapor 3 website to easily browse HomeKit accessories.
Stars: ✭ 75 (-27.88%)
Mutual labels:  server-side-swift
routing-kit
🚍 High-performance trie-node router.
Stars: ✭ 95 (-8.65%)
Mutual labels:  server-side-swift
readme
Welcome to Vapor development at Nodes 📖
Stars: ✭ 47 (-54.81%)
Mutual labels:  server-side-swift
GraphQLRouteCollection
A GraphQL based RouteCollection for Vapor
Stars: ✭ 18 (-82.69%)
Mutual labels:  server-side-swift
auth
👤 Authentication and Authorization framework for Fluent.
Stars: ✭ 51 (-50.96%)
Mutual labels:  server-side-swift
Perfect-Markdown-Editor
This project demonstrates how to build an Online Markdown Editor based on Perfect HTTP Server, Perfect WebSocket and Perfect Markdown.
Stars: ✭ 16 (-84.62%)
Mutual labels:  perfect

Perfect-HTTPServer 简体中文

Get Involed with Perfect!

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

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

HTTP Server for Perfect

This repository contains the main HTTP 1.1 & HTTP/2 server.

If you are using this server for your Perfect Server-Side Swift project then this will be the main dependency for your project.

.package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", from: "3.0.0")

If you are starting out with Perfect look at the main Perfect repository for details.

If you are beginning a new project with Perfect look at the PerfectTemplate project for starter instructions.

When building on Linux, OpenSSL 1.0.2+ is required for this package. On Ubuntu 14 or some Debian distributions you will need to update your OpenSSL before this package will build.

HTTP/2

As of version 2.2.6, experimental HTTP/2 server support is available but is disabled by default. To enable HTTP/2, add "alpnSupport" to your server's TLSConfiguration struct:

let securePort = 8181
let tls = TLSConfiguration(certPath: "my.cert.pem", 
						alpnSupport: [.http2, .http11])

try HTTPServer.launch(
	.secureServer(tls,
	              name: "servername",
	              port: securePort,
	              routes: secureRoutes))

This will enable HTTP/2 to be used over secure connections if the client supports it. If the client does not support HTTP/2 then the server will use HTTP 1.x. HTTP/2 support is only offered over secure connections. Setting the global http2Debug variable to true will have the HTTP/2 server print much debugging information to the console while in use.

Please contact us if you experience any problems or incompatibilities while experimenting with HTTP/2 support.

QuickStart

Add the dependency to your Package.swift

.package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", from: "3.0.0")

In your app, launch one or more servers.

// start a single server serving static files
try HTTPServer.launch(name: "localhost", port: 8080, documentRoot: "/path/to/webroot")
 
// start two servers. have one serve static files and the other handle API requests
let apiRoutes = Route(method: .get, uri: "/foo/bar", handler: {
        req, resp in
        //do stuff
    })
try HTTPServer.launch(
    .server(name: "localhost", port: 8080, documentRoot:  "/path/to/webroot"),
    .server(name: "localhost", port: 8181, routes: [apiRoutes]))
 
// start a single server which handles API and static files
try HTTPServer.launch(name: "localhost", port: 8080, routes: [
    Route(method: .get, uri: "/foo/bar", handler: {
        req, resp in
        //do stuff
    }),
    Route(method: .get, uri: "/foo/bar", handler:
        HTTPHandler.staticFiles(documentRoot: "/path/to/webroot"))
    ])
 
let apiRoutes = Route(method: .get, uri: "/foo/bar", handler: {
        req, resp in
        //do stuff
    })
// start a secure server
try HTTPServer.launch(.secureServer(TLSConfiguration(certPath: "/path/to/cert"), name: "localhost", port: 8080, routes: [apiRoutes]))

Documentation

For further information, please visit perfect.org.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].