Coder Social home page Coder Social logo

kitura / kitura Goto Github PK

View Code? Open in Web Editor NEW
7.6K 7.6K 494.0 7.61 MB

A Swift web framework and HTTP server.

Home Page: http://www.kitura.dev

License: Apache License 2.0

Swift 98.28% Ruby 0.17% HTML 0.26% Objective-C 0.08% CSS 0.20% Shell 1.02%
kitura routing server server-side-swift ssl swift web

kitura's Introduction

Kitura

A Swift Web Framework and HTTP Server

Docs Build Status - Master macOS Linux Apache 2 codecov codebeat badge Slack Status

Summary

Kitura is a web framework and web server that is created for web services written in Swift. For more information, visit www.kitura.dev.

Table of Contents

Features

  • URL routing (e.g., GET, POST, PUT, DELETE, PATCH)
  • Codable routing
  • URL parameters
  • Static file serving
  • FastCGI support
  • SSL/TLS support
  • Pluggable middleware

Getting Started

Visit https://www.kitura.dev for a Getting Started guide, tutorials, and API reference documentation.

Contributing to Kitura

All improvements to Kitura are very welcome! Here's how to get started with developing Kitura itself.

  1. Clone this repository.

$ git clone https://github.com/Kitura/Kitura

  1. Build and run tests.

$ swift test

You can find more info on contributing to Kitura in our contributing guidelines.

Notes

  • Swift-NIO is now the default network engine via the Kitura-NIO package. If for some reason you require the old Kitura-net package, you can still enable it by setting an environment variable KITURA_NIO=0 during build.
  • Most Kitura packages have been updated to require at least Swift 5.2 in order to maintain backward compatibility.

Community

We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!

kitura's People

Contributors

andrew-lees11 avatar bdhernand avatar dannys42 avatar dfirsht avatar djones6 avatar dsperling avatar dylanneild avatar helenmasters avatar ianpartridge avatar irar2 avatar kilnerm avatar kweinmeister avatar kyemaloy97 avatar lroseblade avatar na-gupta avatar nacho4d avatar naithar avatar nikitasullivan avatar pbohrer avatar quanvo87 avatar rfdickerson avatar rob-deans avatar rolivieri avatar saihemak avatar shihabmehboob avatar shmuelk avatar tfrank64 avatar tunniclm avatar vadimeisenbergibm avatar youming-lin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kitura's Issues

Add to the Kitura-router the ability to add error handlers

Add to the Kitura router the ability to add error handlers which can be invoked when a handler or middleware indicates that it encountered an error. This error handler could be the part of a server application that creates and returns the error page.

Add to the ContentType "helper" in Kitura-router more content types by integrating SwiftyJSON

The Kitura-router has a helper class that deals with Content-Type headers and mime types.

Currently it supports a small set of hard coded content types.

This list needs to be externalized, akin to what is done in similar functionality in Express. In fact it would be good to adopt their external file of content types and file extensions.

A major issue is where to place this file and how does it stay with the executable if one moves it

Determine if NSOperationQueue could be used for executing async functions in a predefined order

Issue by ricardo-olivieri
Wednesday Jan 13, 2016 at 20:55 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/42


This is an exploratory task (dependent on the libdispatch library) The following is just pseudocode for reference:

backgroundQueue.addOperationWithBlock(clousure1);
backgroundQueue.addOperationWithBlock(clousure2);

Where closure1 is the handler in the router code for processing the http request and http response (code provided at the app level) and closure2 is the next() closure that is used internally by the middleware router layer (not the app).

See the following links for further details:
https://tetontech.wordpress.com/2014/06/30/swift-nsoperationqueues-and-threading/
https://thatthinginswift.com/background-threads/
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSOperationQueue_class/#//apple_ref/occ/instm/NSOperationQueue/addOperationWithBlock

[CLOSED] Get libcurl and libhttpParser helpers to compile (a and dylib) using a build script. (interim solution)

Issue by rfdickerson
Wednesday Jan 13, 2016 at 00:25 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/39


Previously, we had httpParserHelper.dylib checked into the repository. However, since it might be bad practice to check in the build dylib into the repository, and we will need a .so file in that directory as well, we should consider how to build this with Swift Package Manager.

We can compile the httpParserHelper "shim" using:

clang -c utils.c -shared -o libhttpParserHelper.so

So that the modulemap can find and link httpParserHelper.so. I think we have 3 options:

  1. Check in to the repository the Darwin dylib and the Linux shared object file.
  2. Figure out how to get Swift Package Manager to build the C code
  3. Move the utils.c and utils.h to another repository and have it use a Makefile to build the shim.

Move from the forked version of libdispatch (maintained by Chris) and use the official one from apple

Issue by rfdickerson
Thursday Jan 07, 2016 at 21:48 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/19


Currently, the swiftc cannot interpret the proprocessing macros inside of header files such as #define's. For example, I can build my program and builds and can execute,

import CDispatch

let q = dispatch_get_main_queue()
let t = dispatch_time(DISPATCH_TIME_NOW, Int64(5*NSEC_PER_SEC))

dispatch_after(t, q, {
    print("hello")
})

dispatch_main()

The Makefile is:

DISPATCH_LIBRARY=-Xcc -fblocks -ldispatch -lpthread -Xlinker -lBlocksRuntime -I Packages/CDispatch-1.0.2

all: main.o

main.o: main.swift
    swiftc main.swift ${DISPATCH_LIBRARY}


clean:
    rm *.o

The executable runs, waits 5 seconds, and prints hello.

However, if I try to use

DISPATCH_QUEUE_CONCURRENT

The Swift compiler cannot resolve that symbol. This symbol is really a #define, and I suspect the Swift frontend compiler cannot resolve the identifier in any typesafe way since it's just a simple code-replacement.

#define DISPATCH_QUEUE_CONCURRENT \
        DISPATCH_GLOBAL_OBJECT(dispatch_queue_attr_t, \
        _dispatch_queue_attr_concurrent)

A proposed solution to this problem would be to add to a custom header file a new definition of DISPATCH_QUEUE_CONCURRENT to instead be a constant global variable instead of a C preprocessor directive.

[CLOSED] As an interim solution, move the following dependencies into the Phoenix repo: HiRedis, Pcre2, HttpParserHelper, and CurlHelpers.

Issue by ricardo-olivieri
Friday Jan 08, 2016 at 19:08 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/25


Given that the current version of Package Manager does not support the functionality we need to successfully build the project on linux, in the meantime, we plan to move these dependencies into the same repo as this project for ease of development.

[CLOSED] Use the updated version of the swift package manager that supports compilation flags

Issue by ricardo-olivieri
Tuesday Jan 12, 2016 at 16:11 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/37


Today, the team decided to use a forked version of the swift package manager that supports compilation flags instead of using custom make files.

This will require an additional step after the installation of the swift compiler:
-Cloning forked version of the swift package manager.
-Building and installing the swift package manager.

We will also need to implement this logic as part of the docker image.

Create a router middleware for compression of data sent to requestor

Create a Kitura-Router middleware that supports the common forms of over the wire compression.

For the gzip compression we should probably use zLib.

This requires some work in the base router to APIs to add "plugins" that operate in the read/write path.

  • Read Accept-Encoding from RouterRequest "gzip, deflate"
  • Add Content-Encoding to RouterResponse: gzip
  • Set correct content-length

[CLOSED] Investigate visibility issue with method and instance variable modifiers on linux (not compiling)

Issue by ricardo-olivieri
Thursday Jan 14, 2016 at 15:57 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/45


We were able to get the build to work. For some reason the closed property in FileDescriptor in IO module is being called in the net module.

public private(set) var closed = false
clang ./build/net.o -shared -o ./build/libnet.so
./build/net.o:(.data.rel+0x1200): undefined reference to `_TFC2io14FileDescriptors6closedSb'
./build/net.o:(.data.rel+0x1208): undefined reference to `_TFC2io14FileDescriptorm6closedSb'
/usr/bin/ld: ./build/libnet.so: hidden symbol `_TFC2io14FileDescriptorm6closedSb' isn't defined

Changing it to public is a temporary workaround:

public var closed = false

Add to Kitura-router improved cookie support

Today one can send and receive cookies in Kitura-router via Cookie headers.

It would be nice to have better APIs for doing this, such as:

  1. A cookies property in the RouterRequest class, which would in a lazy fashion parse all of the incoming headers looking for cookies.
  2. A setCookie function in the RouterResponse class to add cookies to the response.
  3. Easier ability to extract cookies for Http.ClientRequests
  4. "CookieJar" support Http.ClientRequests, to automate the resending of Cookies received in earlier requests.

Our Cookie class in our APIs should NSCookie from foundation, which is already pure Swift.

[CLOSED] Improve the PhoenixTestingFramework for Continuous Integration

Issue by KALLNER
Friday Jan 08, 2016 at 12:13 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/23


  1. Currently the binaries created by PhoenixTestingFramework exit after an error is detected.

    For continuous integration, the needed functionality is that when an assertion fails, the test running s stopped, while the rest of the tests in that test case and any other tests cases are still executed.

  2. The current XCTest code on which the PhoenixTestingFoundation is based, doesn't have the XCTestExpectation based APIs, neither the class, not the APIs in XCTestCase.

    This makes it hard to test asynchronous APIs.

Get SwiftyJSON to compile on linux (or remove dependency on it)

Issue by ricardo-olivieri
Wednesday Jan 06, 2016 at 22:58 GMT
Originally opened as https://github.ibm.com/ibmswift/Phoenix/issues/2


Some of the Swfit code in the net module depends on the SwiftyJSON library. As of now, we cannot get the SwiftyJSON library to compile.

This issue may have to be revisited. For instance, an alternative to SwiftyJSON is the following library (which is written entirely in Swift): https://github.com/Zewo/JSON. Another alrernative is to simply eliminate any dependencies on 3rd party Swift libraries.

Probably the benefits of using SwiftyJSON are negligible. For instance, when compared to the Gson library, SwiftyJSON does not even provide a quarter of the functionality Gson provides.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.