Heze is a light Swift server-side framework powered by Perfect 3.x.
Heze recommends MySQL 5.7.
mysql server 5.7
installed on your Mac.username
and password
field in config file at Workspace/HezeDemo/config.json
.swift package generate-xcodeproj
to generate the Xcode project.main.swift
at HezeDemo
.http://localhost:8080
to see how the demo looks.HezeHandler
to process request and return a JSON object by using HezeResponse
method.HezeView
or HezeListView
. HTML rendering uses Mustache
tech which is powered by Perfect-MustacheRoutes need to be registered in AppDelegate. See the demo.
HezeRequestFilter
. Override requestFilter
method to decide if the request can pass the filter.HezeResponseFilter
.HezeSessionRequestFilter
is a request filter to process session. Tokens are stored in MySQL by default.Filter need to be registered in AppDelegate as a plugin.
Use HezeTimer
.
Timer need to be registered in AppDelegate as a plugin.
Workspace contains:
config.json
: Configration.Public
: Static resources.Views
: Web templates.Context system allows you to create multiple servers in one target.
Every AppDelegate requires a context. HezeApp
will storage some env vars in this context when it inits.
There are main context and meta context by default. You can create more context. See HezeContextBox
.
DO NOT TOUCH META CONTEXT.
Heze supports email.
Adding these config in config.json
will enable the email client.
"mail": {
"smtp": "smtp://xxx",
"username": "noreply@xxx",
"password": "",
"name": "xxx-NoReply",
"interval": 3.0,
}
It's powered by PerfectSMTP.
Look at class HezeDatabase
. It's a abstract interface of database. Feel free to implement HezeDatabaseImpl
yourself.
You may need to process Session yourself because HezeSessionRequestFilter
is powered by PerfectSessionMySQL.
My website https://blog.yuusann.com is powered by Heze and SPiCa.
SPiCa is another framework which is used to create Vue app using Swift. Not opensource yet.
Feel free to contact me: [email protected]
link |
Stars: 11 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics