Giter Club home page Giter Club logo

serversideswift's Introduction



Swift Version Vapor Version GitHub license

中文文档🇨🇳

This is a Swift Server Side open source project built on the Swift 4.1 and Vapor 3 frameworks.

Because of apple’s release of the cool event-driven non-blocking network framework SwiftNIO, Vapor 3 introduced it at a blazing pace, leading to Vapor 2 and Vapor 3. The grammar is very different. For me personally, it looks like the difference between Swift 2 -> Swift 3 is awkward. So I used Vapor 3 to rewrite part of the interface and open it for reference and communication with interested partners. Currently listed in the document API has been deployed in a formal environment application, and will continue to be perfected as needed.

Projects are deployed at http://api.jinxiansen.com (Ubuntu 16.04), most api can be debugged directly here.

Here are just a few basic API and instructions. For more information, please download the project.

Preview 📑

This project includes but is not limited to the following:

  • Complete login, registration, password change, and exit function
  • Send personal updates, get dynamic lists, get dynamic pictures, report
  • Chinese characters, idioms, and after-sentence queries
  • Crawler example: Crawling the iOS job information to get the crawl results
  • Example of crawling novels: mortal cultivation into a biography of God
  • Python interaction: Swift calls native Python(.py) with parameter interaction examples
  • Example of mail delivery
  • HTML display example.

👉 From here , preview the currently completed API sample documentation and debugging.

Installation 🚀

Preliminary work of running the project:

If you prefer mysql, you can see here.

Feedback 🤔

If you have any questions or suggestions, you can submit a Issue ,

or contact me with email: [email protected]

License 📄

SwiftServerSide-Vapor is released under the MIT license. See LICENSE for details.

serversideswift's People

Contributors

jinxiansen 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

serversideswift's Issues

static css file fail

leaf静态文件好像加载不了。
https://v4.bootcss.com/docs/4.0/components/buttons/
这个直接使用可以

<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

使用本地文件不行

<link rel="stylesheet" href="/static/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

如果使用前后端分离、你这个web登录和refreshtoken如何处理?

validation account and password is error

LoginUser.swift

line 37 func validation:

if account.isAccount().0 == false {
return account.isAccount()
}

if password.isPassword().0 == false {
return account.isPassword()
}

The condition on the right should be false

RefreshToken和Container的作用

请教三个问题:

  1. RefreshToken 结构体用什么作用吗?还是在实际应用中会用到?
    RefreshToken 只比 AccessToken 少一个 expiryTime 字段。

  2. struct xxxxContainer ,这类结构体有什么作用?数据容器或者数据转换?

  3. let digest = try req.make(BCryptDigest.self)。为什么需要用make不自己init?因为有缓存吗?

ps
非常感谢你分享的库,开阔视野,学到很多东西!
期待你的回复。

无法顺利build

使用vapor build后会出现ERROR试问大神有解决方式吗?

Error (1):
error: multiple products named 'Logging' in: Console, swift-log
error: multiple targets named 'Logging' in: Console, swift-log

你的这个例子里终端里的注册请求失败

➜  ~ curl --request POST \ --url http://localhost:8080/users/register \ --header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \ --form [email protected] \ --form password=qbter123
curl: (6) Could not resolve host:  --url
{"error":true,"reason":"Request does not have a content type."}curl: (6) Could not resolve host:  --header
curl: (3) Port number ended with ' '
curl: (6) Could not resolve host:  --form
<!DOCTYPE html><html><head><title>Foxmail</title><meta http-equiv="refresh" content="0; url=http://www.foxmail.com/" /></head><body style="background:#292929 url(./images/pc/zh/mainbanner_bg.png) 0 0 repeat;"></body></html>
curl: (6) Could not resolve host:  --form
curl: (6) Could not resolve host: password=qbter123

修改成这个可以用

➜  ~ curl -H "Content-Type: application/json" -X POST -d '{"account":"[email protected]","password":"qbter123"}' http://localhost:8080/users/register
{"status":0,"message":"注册成功","data":{"accessToken":"yjJG_2aWcGfyQDbmopYbSSOIGLH0x0BcLcWrh-hbSJg","userID":"B200F407-7511-4415-9A40-10B48A72B565"}}

你自己测试的是可以直接用吗?

執行vapor run時有錯誤

執行vapor run時有錯誤如下

Running VaporServer ...
[INFO] 启动数据库:vaporDebugDB
(/Users/github/SwiftServerSide-Vapor-master/VaporServer/Sources/App/Utility/MySQLConfig.swift:sqlData:58:28)
[ INFO ] Migrating 'mysql' database (MigrationConfig.swift:69)
Fatal error: Error raised at top level: ⚠️ MySQL Error: Full authentication not supported over insecure connections.

  • id: MySQLError.fullAuthRequired

File: /Users/github/SwiftServerSide-Vapor-master/VaporServer/.build/checkouts/mysql.git-1890032512239690518/Sources/MySQL/Connection/MySQLConnectionHandler.swift

  • func: handlePacket(ctx:packet:)
  • line: 52
  • column: 37

Here are some possible causes:

  • Using 'caching_sha2_password' auth plugin (default in MySQL >= 8.0.4) over an insecure (no SSL) connection.

These suggestions could address the issue:

  • Use a secure MySQLTransportConfig option in your MySQLDatabaseConfig.
  • Use a MySQL auth plugin that does not require full authentication (like 'mysql_native_password').
  • Use MySQL < 8.0.4.

Vapor's documentation talks about this:

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.