crossroadlabs / express Goto Github PK
View Code? Open in Web Editor NEWSwift Express is a simple, yet unopinionated web application server written in Swift
License: GNU General Public License v3.0
Swift Express is a simple, yet unopinionated web application server written in Swift
License: GNU General Public License v3.0
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?
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
BrightFutures is interesting, but some of the notation seems a little clunky to me. Thanks!
Add support for https://github.com/kylef/Stencil templates
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.
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
On Ubuntu15.10, we also need another command to make a success on build dispatch
sudo apt-get install libpthread-workqueue-dev
and then ,build dispatch will succeed
Thanks
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
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!
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
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: "Русский язык"
When running the Getting Started guide the CPU usage stays constant on 100%+ CPU usage
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"]
good
The express does not build on Linux nor Mac OS X using the latest Swift Development snapshots (2.2 or 3.0).
Also the SPM build does not work either with the provided Package.swift file.
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")
}
Here is an example:
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
*** Cloning Box
Failed to discover shared schemes in project MustacheDemoiOS7.xcodeproj—either the project does not have any shared schemes, or xcodebuild never returned
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.