IDE
Sublime Text
- Download and install https://www.sublimetext.com/3
- Drag a file with the extension .
z1hDrag into the Sublimt Text panel - Select
View>Syntax>Open all with current ...>JavaScript>JavaScriptin the upper menu bar
Run configuration
via the command line z1h -conf configuration file ie Z1h can be started by applying the configuration. The configuration file is in json format
After decompressing the .zip file, you will see a conf.json file, run z1h -conf conf.json to try
field explanation
| field name | Type | Meaning | Default Value | Example |
|---|---|---|---|---|
| dir | string | Data directory | datas | / data / z1h / |
| key | string | Key password, used to update the front end | - | |
| serverless | object | http service routing and other configuration items | - | - |
| -api | object | |||
| Ap configuration related to running http service | -api- | - router | string | route address |
| -api- | -dir | string | local directory address | |
| -socket | same structure as api | web socket service configuration | ||
| -tcp | The structure is the same as api | tcp monitoring service configuration | ||
| -tcp- | -port | Run port number | - | |
| -tcp- | -file | Z1h file to run | - | |
| -udp | The structure is the same as tcp | udp listening service configuration | ||
| -expire | int | z1h file cache duration, unit seconds | 1 | |
| -statics | array | Static file service | ||
| -statics [..] | structure is the same as api | |||
| -interval | string | Directory to run loop / timed tasks | ||
| log | string | log file name | - | |
| -db | object | database information | - | - |
| -type | string | database type | mysql | |
| -address | string | Database address | - | |
| array | Multiple databases / master-slave | - | - | |
| -dbs [..] | Same structure as db | |||
| dbGroup | bool | Whether to open the database group (read and write Separation) | false | |
| -redis | object | Redis information | - | - |
| -address | string | Redis address | ||
| -password | string | password | ||
| -select | int | Redis library | ||
| repl | object | interactive configuration | - | - |
| -terminal | bool | Whether to enable interaction on the command line | false | |
| -web | object | Web interactive configuration | ||
| -web- | -router | string | Web interactive url address | |
| -web- | -users | \ [] \ [2 ] string | Web interactive account password list | |
| initFiles | array | List of file paths for initial operation | ||
| - | ||||
| -port | - | Run port number | - | 30030 noFront |
| -extra | - | Extra configuration | - | - |
Example
{
"dir": "datas",
// "key": "xxxxxxx.",
"log": "datas/log/log",
"port": 30030,
"db": {
"type": "mysql",
"address": "username:password@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4,utf8"
},
"initFiles": ["datas/init.z1h"],
"serverless":
{
"api":
{
"router": "/api",
"dir": "datas/api"
},
"socket":
{
"router": "/socket",
"dir": "datas/socket"
},
"interval": "datas/interval"
},
"tcp":
{
"port": 30031,
"file": "datas/tcp.z1h"
},
"udp":
{
"port": 30031,
"file": "datas/udp.z1h"
},
"noFront": true,
"repl":
{
"web":
{
"router": "/z1h",
"users": [
// ["xxx", "xxxxx."]
]
}
}
}