Giter VIP home page Giter VIP logo

perfectlysoft / perfect Goto Github PK

View Code? Open in Web Editor NEW
13.8K 596.0 947.0 5.33 MB

Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)

Home Page: https://www.perfect.org

License: Apache License 2.0

Swift 100.00%
swift server-side-swift web-application-framework swift-framework swift-perfect-community perfect

perfect's People

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

perfect's Issues

Building on Linux

I've spent the last two days trying to get a project with several dependencies compiled and running on Linux. The other projects I've been working with use the Swift Package Manager approach, a Package.swift definition file plus /Sources directory, which makes it very easy to link dependencies from their github repo URL.

Perfect on the other hand uses a makefile. It would be really nice to be able to reference PerfectLib in the same manner, but it doesn't appear the project is structured to be Swift Package Manager friendly (unless I'm missing it).

What's the prospects of getting the Perfect project structured to work with Swift Package Manager, and in the meantime, what's your recommended approach for using Perfect as a dependency for projects building on Linux?

Thanks.

Moustache: empty comments cause parsing error

The following works:
{{% handler:FAHandler}}{{!
This is the moustache template file
}}{"resultSets":[{{#resultSets}}{"time":"{{time}}","lat":{{lat}},"long":{{long}} }{{^last}},{{/last}}{{/resultSets}}]}

While this causes parsing problems:

{{% handler:FAHandler}}{{!

}}{"resultSets":[{{#resultSets}}{"time":"{{time}}","lat":{{lat}},"long":{{long}} }{{^last}},{{/last}}{{/resultSets}}]}

The system skips the closing empty comment delimiters.

Issue when launching the server on Ubuntu 15-10 : "the file / was not found"

Hello,

I have a problem when i launch the perfectserverhttp from Ubuntu 15-10.
capture d ecran 2015-12-14 a 17 59 00

The server launches properly, but then i can't manage to work with it. The message "The file "/" was not found" is displaying on the navigator.

Could it be because i use a virtual machine? Or did i do something wrong with the installation? I followed step by step the instructions written in the Readme files.

Thanks in advance!

Library not loaded: @rpath/libswiftAppKit.dylib

Setup:
Using the Xcode template I created a new Perfect Server Project, modified the scheme to include the executable PerfectServer HTTP.app, added PerfectLib.Framework to the linked libraries and binaries. The project runs and PerfectServerModuleInit() executes in the project.

Problem:
I was never able to get a request to the mustache template in my project, I was still able to send requests to TapTracker, Authenticator, and UploadEnumerator (login, request, TapTracker...). I went to the webroot directory and saw login, request, TapTracker... but not my mustache template. Looking deeper I ran the executable PerfectServer HTTP and the following message comes out after multitude of other messages come out

Output:
objc[4290]: Class _TtCSs18_EmptyArrayStorage is implemented in both /Users/Cam/Library/Developer/Xcode/DerivedData/Examples-aqjpcyrjmijblwavckfeldxenqlq/Build/Products/Debug/PerfectLib.framework/Versions/A/Frameworks/libswiftCore.dylib and /Users/Cam/Library/Developer/Xcode/DerivedData/Examples-aqjpcyrjmijblwavckfeldxenqlq/Build/Products/Debug/perfectserverhttp. One of the two will be used. Which one is undefined.

Errno dlopen(./PerfectLibraries/MyTestPerfectServer.framework/Versions/Current/MyTestPerfectServer, 6): Library not loaded: @rpath/libswiftAppKit.dylib
Referenced from: /Users/Cam/Library/Developer/Xcode/DerivedData/Examples-aqjpcyrjmijblwavckfeldxenqlq/Build/Products/Debug/MyTestPerfectServer.framework/Versions/Current/MyTestPerfectServer
Reason: image not found
FAILED to load MyTestPerfectServer.framework/

MySQL Connector Build Failed

Have an error on line 53 of MySQL.swift:
static private var dispatchOnce: Threading.ThreadOnce = 0
-- Cannot convert value of type'Int' to specified type 'ThreadOnce' (aka '_opaque_pthread_once_t')

no such module "perfectlib"

main_http.swift while using XCode 7.2

Just needs the build settings modified slightly

PerfectLib -> Build Settings -> Packaging -> Defines Module

It currently defaults to No causing the error.

Cannot build on osx, make failed

Got this after running make on el capitan, did i miss something?

:1:9: note: in file included from :1:

import "openssl/ssl.h"

    ^

/Users/zipeldiablo/Perfect/PerfectLib/linked/OpenSSL_Linux/openssl/ssl.h:146:11: note: in file included from /Users/zipeldiablo/Perfect/PerfectLib/linked/OpenSSL_Linux/openssl/ssl.h:146:

include <openssl/e_os2.h>

      ^

/Users/zipeldiablo/Perfect/PerfectLib/linked/OpenSSL_Linux/openssl/e_os2.h:56:10: error: 'openssl/opensslconf.h' file not found

include <openssl/opensslconf.h>

     ^

NetTCPSSL.swift:26:8: error: could not build Objective-C module 'OpenSSL'
import OpenSSL
^
make[1]: *** [ICU.o] Error 1
make: *** [all] Error 2

Routing

Hi, I can't find in doc. How I can handle routing with Perfect?

Suggestion: Object mapping for JSON

Dear Kyle,

thank you first for the effort you already put into this project. I really hope that server-side Swift will take its place in the future. We need someone who start with a project like this and if people like it you will get support for sure.

Besides that i have one suggestion regarding the json serialization/deserialization.
In my projects i use ObjectMapper from Hearst as it allows me to write classes and create a mapping of static types and a JSON output or input. Also i can define custom formatters to catch an convert my content on the fly, based on the mapping i defined in my mappable classes.

It would be nice to see an approach like this as it allows us developers to rely on what we define. This kind of approach already works with AlamofireObjectMapper and makes it totally easy and safe to handle untyped data in a strongly typed world.

Thanks in advance and good luck,
Stefan

PerfectLib compiled, but PerfectServer failed

Running on Ubuntu 14.04

As per the subject, PerfectLib compiled without error, but I get errors when trying to compile the Server. Error is as follows:

clang++ -L/usr/local/swift-2.2/usr/lib/swift/linux -lFoundation -lswiftCore -lswiftGlibc /usr/local/lib/PerfectLib.so -Xlinker -rpath -Xlinker /usr/local/swift-2.2/usr/lib/swift/linux perfectserverfcgi.o -o perfectserverfcgi
/usr/local/lib/PerfectLib.so: undefined reference to u_isalnum_55' /usr/local/lib/PerfectLib.so: undefined reference toudat_format_55'
/usr/local/lib/PerfectLib.so: undefined reference to udat_close_55' /usr/local/lib/PerfectLib.so: undefined reference tou_isWhitespace_55'
/usr/local/lib/PerfectLib.so: undefined reference to udat_open_55' /usr/local/lib/PerfectLib.so: undefined reference tou_errorName_55'
/usr/local/lib/PerfectLib.so: undefined reference to ucal_getNow_55' /usr/local/lib/PerfectLib.so: undefined reference toudat_parse_55'
/usr/local/lib/PerfectLib.so: undefined reference to `u_isdigit_55'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [perfectserverfcgi] Error 1

Thanks

MYSQL / MongoDB Doc

I frenquently use MYSQL or MongoDB for my websites, APIs and other and I would like to use these with Perfect.. But we haven't docs for these Connectors

pthread_cond_timedwait_relative_np unresolved,any one can help me?

Threading.swift:99:14: error: use of unresolved identifier 'pthread_cond_timedwait_relative_np'
let ret = pthread_cond_timedwait_relative_np(&self.cond, &self.mutex, &tm);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Threading.o] Error 1

error occur when i make

tvOS support

After this I feel obliged to share some of the process here. Ideally I would like to turn this into a pull request, but as my hacking isn't really ready for merging yet, I'll just share the steps I remember here, so the thinking doesn't have to be performed twice :)

  • Copied OSX target and changed the SDK to tvOS
  • Added import Foundation to some files
  • Removed SysProcess from the tvOS target
  • Built custom tvOS versions of libcurl.a libssl.a and lib crypto.a using this
  • Built custom version of libevent using this (I'm not really sure of the removal of fork in this case, but as it's only in tests, it should be okay)
  • Replaced the other libraries (libicu and libsqlite) with the tvOS versions provided by Apple

A problem that I haven't solved yet, but shouldn't be hard is that the creation of the session database currently fails, because it uses a file it can't access. This is also a theoretical problem: As we are only allowed to store cache on appleTV, does in matter if the session database gets wiped every time the app quits? Probably not, depending on your use case.

I hope I covered everything. As I said, I will try and fix this up in a PR soon!

The file "TapTracker" was not found.

i built the server and module, run the server:
1

then i tap the button in Tap Tracker APP, its get this response:
Request succeeded with data Optional("The file "/TapTracker" was not found.")
JSON decoding failed with exception SyntaxError("Malformed boolean literal")

how can i resolve it?

Trailing URL Variables not placed in urlVariables dictionary

I would expect urlVariables to contain an entry for id in the following case:

Routing.Routes["GET", "/device/{id}"]

It doesn't. Adding a trailing component to the URL it does get populated:

Routing.Routes["GET", "/device/{id}/show"]

Extending further,

Routing.Routes["GET", "/device/{id}/show/{sub}"]

sub is not in the the urlVariables dictionary but id is.

WebRequest has no method for accessing body

The current implementation of WebRequest appears to try to assume/do too much. Particularly in the event of POSTing Content-type: application/json, I should be able to post a document body with a properly formed JSON string. Then, in my handler I can access the body directly (what appears to be request.connection.stdin but that is protected) without any "intelligence" from postParams processing.

JSONEncode should use type methods or be renamed JSONEncoder

Hi everybody,

First of all I wanna thank everyone for the great work on this project. I'm so excited about being able to use swift in full stack mode!

I was browsing through the docs and came across the JSONEncode and JSONDecode classes. Initially I was thinking it would make more sense for the JSONEncode class to use type methods (a.k.a. static methods) but then I checked out the JSONDecode class and noticed it uses instance variables. So what would be more appropriate would be to rename the classes to JSONEncoder and JSONDecoder because the instances of these types will be doing the job.

I can perform a refactoring and submit a pull request. What do you guys think?

Califrench

Deploy on AWS?

I'm assuming this can't be deployed to a real production server yet, since it can't run on linux.
Is that something that is only reconcilable after Apple open sources the language?

Nevertheless, not being able to scale the servers made is definitely an issue.

How to run MySQLTests.swift?

How can I run MySQLTests.swift on ubuntu?

I've copied both MySQL.so and MySQL.swift to Perfect/Connectors/MySQL/MySQLTests.

When I execute swift MySQLTests.swift, I always get error: no such module 'MySQL'

Send data with POST / GET request

Hi,
First, thank you so much for your awesome framework.
Please help to explain how could i send data with POST / GET request from client and how to receive those params on server via Swift code ?
Many thanks for your help.

support for web sockets and socket.io planned?

We use socket.io in our current Swift iOS app and would love to move from Node.js to perfect.

Please consider adding socket.io support into your plans. A roadmap of features (and a place to vote for your favorite) would be a great addition to this project.

Consistent swift coding style

Taken from this reddit comment:: https://www.reddit.com/r/swift/comments/3ttu9u/serverside_swift_is_here_its_perfect/cx9hrpc

Nice work!
I have one suggestion though - be more consistent wrt to code conventions. For example, top
level constants (from one module) are defined in
- lowercase snake case
- uppercase snake case
- camelCase
...

by 20DCCD77-E82E-4045-A

I would suggest using https://github.com/raywenderlich/swift-style-guide as your style guide. At least as a mold for a style guide. It seems to be very good.

Suggest: use tyrone-sudeium/JSONCore instead of JSON.swift

I tried tyrone-sudeium/JSONCore, it's Foundation free. I try serialize ["ad":[["i": -41451, "i2": 41451, "d": -42E+2, "t": true, "f": false, "n": nil, "a":[1, 2, 3, 4]], ["another":"one"]]] and it works properly.
JSON.swift still have a lot of work to make it work. I think we should just use tyrone-sudeium/JSONCore for JSON parse/serialization and focus on some other Perfect module.

Tap Tracker Example error

Hey, I was trying out the Perfect project and I had an error executing the target Tap Tracker in the Examples.workspace:

~/Perfect-master/PerfectLib/Utilities.swift:427:16: Use of unresolved identifier 'File'

Benchmarks

It'd be great to see benchmarks compared to other languages and frameworks.

no umbrella header

Great project !

But I have some question..
I clone the repo and build the PerfectLibOSX target in Examples.xcworkspace.
But then I got a warning

warning: no umbrella header found for target 'PerfectLibOSX', module map will not be generated

Is this normal?
My Xcode is Version 7.2 (7C68)

Docker image

Hi there,

I'm one of the contributors to https://github.com/swiftdocker/docker-swift. If there's any interest in vendoring a docker image containing the suite of Perfect libraries and possibly the server (though I wonder if long term a server isn't really in your interest, given that nginx etc exist) for easy development and deployment, please let me know if I can be of any assistance!

Mark Classes as final

Optimizes code to C++, level performance.

Also, in the MySQL class, you would not want that to be subclassed, and the internal pointer should be private.

Getting started error: No such module PerfectLib

I am trying to get started with Perfect and just cloned the repository.

Opened up 'Authenticator' and tried to build the Authenticator Server. Got an error (No such module PerfectLib).

no such module

So, I opened up PerfectLib and tried to build it. It build :-) but gave an error of 'No umbrella header found for target 'PerfectLibOSX, module map will not be generated.

no umbrella header

After building the PerfectLib (with this warning) and going back to the Authenticator project, I still get the same error.

I suspect I missed a simple step here. Can someone suggest what I missed?

Thanks,

Charlie

Swift NGINX Module?

A moderate feature request: Perfect has an Apache connector; it would be great to see an NGINX module too!

An ExpressJs like framework.

Hi, I am planning on developing an ExpressJS like framework using swift. I was searching for a swift NetTCP library but could not find one. I like your NetTCP implementation, it is really neat. So, could you publish it as a separate swift package? Thanks in advance

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.