GithubHelp home page GithubHelp logo

crossroadlabs / express Goto Github PK

View Code? Open in Web Editor NEW
847.0 42.0 47.0 520 KB

Swift Express is a simple, yet unopinionated web application server written in Swift

License: GNU General Public License v3.0

Swift 100.00%
swift linux asynchronous server swift-express reactive crossroad-labs linux-support

express's People

Contributors

dileping avatar killev avatar peagasilva avatar ypopovych 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

express's Issues

What does request.query mean?

Hello guys,
I'm testing the form's processing and it behaves wierd.
my form:

<html>
<body>
<form method="POST" action = "/"><input name="param" type="text"/><input type="submit"/></form>
<br>
Submitted: {{submitted}}
</body>

</html>

My server code:

app.post("/") { (request:Request<AnyContent>)->Action<AnyContent> in
    print("Params:" ,request.params)
    print("Query:",  request.query)
    return Action<AnyContent>.render("index",context: ["submitted": ""])
}

app.get("/") { (request:Request<AnyContent>)->Action<AnyContent> in
    return Action<AnyContent>.render("index",context: ["submitted": ""])
}

The result is:

Merged: ["param": ["12345", "12345"]]
Query: ["param": ["12345"]]

Seems like mergedQuery adds the same value twice??? Why?? What query and mergedQuery are expected to be then?

Error on: swift-express init HelloExpress

Hello,

I've tried getting started on El Capitain, but got this error after issuing swift-express init HelloExpress:

CompileSwift normal x86_64 /Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/Transaction.swift
CompileSwift normal x86_64 /Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/Static.swift
CompileSwift normal x86_64 /Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/ErrorHandler.swift
CompileSwift normal x86_64 /Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/ExpressSugar.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(5 failures)
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Modules/CPthread/module.map:23:9: error: header '/usr/include/pthread.h' not found
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/HttpServer.swift:24:8: error: could not build Objective-C module 'CPThread'
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Modules/CPthread/module.map:23:9: error: header '/usr/include/pthread.h' not found
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/HttpServer.swift:24:8: error: could not build Objective-C module 'CPThread'
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Modules/CPthread/module.map:23:9: error: header '/usr/include/pthread.h' not found
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/HttpServer.swift:24:8: error: could not build Objective-C module 'CPThread'
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Modules/CPthread/module.map:23:9: error: header '/usr/include/pthread.h' not found
/Users/kdreiners/HelloExpress/Carthage/Checkouts/Express/Express/HttpServer.swift:24:8: error: could not build Objective-C module 'CPThread'
A shell task failed with exit code 65:

Thanks in advance

Best

Klaus-Dieter

Build HelloExpress example failed because of git clone a package called Result

I do just as the document said, write a Package.swift
import PackageDescription

let package = Package(
name: "HelloExpress",
dependencies: [
.Package(url: "https://github.com/crossroadlabs/Express.git", majorVersion: 0, minor: 3),
]
)

but when I run ./build , it clones many repo and finally failed with a message called

error: Failed to clone https://github.com/antitypical/Result.git
Packages/Result' already exists and is not an empty directory.

I want to know why there are so many packages even the Package.swift uses only one, and why the Reault package comes into failure.

launch path not accessible

I followed the instructions in the readme and swift-express run fails.

OS 10.11.4
xcode 7.3

$ swift-express run Running cxo-report-generator... Unhandled error in RunStep. Error: SubtaskError("Task launch error: launch path not accessible") Subtask Error: Task launch error: launch path not accessible

Any idea about Nimble problem ?

Hello Guys,

I have tried tree different machine. I have always taken same error message below.

brew install swift-express
==> Installing swift-express from crossroadlabs/tap
==> Cloning https://github.com/crossroadlabs/ExpressCommandLine.git
Updating /Library/Caches/Homebrew/swift-express--git
==> Checking out tag 0.2.1
==> carthage update --platform Mac
Last 15 lines from /Users/duruldalkanat/Library/Logs/Homebrew/swift-express/01.carthage:
The following build commands failed:
CompileSwift normal x86_64 /tmp/swift-express20160324-691-1jkr1m1/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble/Adapters/NimbleXCTestHandler.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

*** Fetching Regex
*** Fetching Commandant
*** Fetching Result
*** Checking out Commandant at "0.8.3"
*** Checking out SwiftTryCatch at "af21e8f91cd994a8ea459540f922f0e5e1c57618"
*** Downloading Regex.framework binary at "v0.4.1: optional groups support"
*** Downloading Result.framework binary at "1.0.2: A Swift Result"
*** xcodebuild output can be found in /var/folders/nz/f5vmppwd7kg44qt1xsdk_b_m0000gn/T/carthage-xcodebuild.Fw3Nwo.log
*** Building scheme "Commandant" in Commandant.xcworkspace
*** Building scheme "Nimble-OSX" in Commandant.xcworkspace

Hot code reload

Please, like Play framework provide hot code reload, this feature make your project one of the most valuable swift web framework on the market

I love your idea behind to get best parts of such great frameworks!

Express v0.4

I don't see any activity for the last 6 months in the repo. Is v0.4 being worked on? Any idea when it will be out (and working with Linux/Swift 3) ?

This is a great project and very needed - I'd be interested if you need help

Crash after seinding POST form form with encoded symblos

Request Headers
Provisional headers are shown

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Content-Type:application/x-www-form-urlencoded
Origin:http://192.168.50.130:9999
Referer:http://192.168.50.130:9999/?param=123456
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Query String Parameters
param:123456
Form Data
param:%F0%F3%F1%F1%EA%E8%E9

Form:


<html>
<body>
<form method="POST" action = "/?param=123456"><input name="param" type="text"/><input type="submit"/></form>
<br>
Submitted: {{submitted}}
</body>

</html>

Entered value: "Русский язык"

Unresolved identifiers issue

I faced following error while running HelloWorld example.

/home/ubuntu/Projects/Project7/Packages/ExecutionContext-0.3.1/ExecutionContext/ExecutionContext.swift:162:15: error: use of unresolved identifier 'time_t'
    let sec = time_t(timeout)
              ^~~~~~
/home/ubuntu/Projects/Project7/Packages/ExecutionContext-0.3.1/ExecutionContext/ExecutionContext.swift:164:16: error: use of unresolved identifier 'time spec'
    var time = timespec(tv_sec:sec, tv_nsec: nsec)
               ^~~~~~~~
/home/ubuntu/Projects/Project7/Packages/ExecutionContext-0.3.1/ExecutionContext/ExecutionContext.swift:166:5: error: use of unresolved identifier 'nano sleep'
    nanosleep(&time, nil)
    ^~~~~~~~~
<unknown>:0: error: build had 1 command failures
error: exit(1): ["/home/ubuntu/swift/swift2.2/usr/bin/swift-build-tool", "-f", "/home/ubuntu/Projects/Project7/.build/debug/ExecutionContext.o/llbuild.yaml"]

Refresh view after async response

When I render a view and call some async API how do I update that view? I could not find any reload/refresh methods in the docs. For example:

app.get("/home") { request in
    HomeController().fetchData { posts in  
       // Update view with response 
    }
    return HomeController.index("/home")
}

** BUILD FAILED ** after "swift-express bootstrap" command

I am getting this error after running the command:

swift-express bootstrap

Error:

** BUILD FAILED **


The following build commands failed:
    CompileSwift normal x86_64 /Users/Moi/Desktop/Swift Express/HelloExpress/Carthage/Checkouts/Result/Result/ResultType.swift
    CompileSwift normal x86_64 /Users/Moi/Desktop/Swift Express/HelloExpress/Carthage/Checkouts/Result/Result/Result.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(3 failures)

Subtask Error: CarthageInstallLibs: bootstrap failed. Exit code 1

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.