Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kosaka-bun committed Jun 23, 2024
1 parent 5e15817 commit 4857521
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,16 @@ class WebActivity : AbstractWebActivity() {
要使应用启动一个HTTP服务,只需直接调用`HttpServer.createInstance()`即可。`HttpServer`所监听的默认端口为`38081`,服务启动前将会检测端口占用情况,若端口被占用,则自动依次按端口号向下寻找可用的端口号,最多寻找10个端口号。若希望更改默认端口号,仅需在调用`createInstance()`前,修改`HttpServerVariables.serverPort`的值即可。

默认情况下,`HttpServer`仅提供静态资源服务,包含以下URL与静态资源的映射:
- `/``/index.html`、任何未定义的路由 → `[assets]/web/index.html`
- `/assets/**``[assets]/web/assets/**`
- `/font/**``[assets]/web/font/**`
- `/img/**``[assets]/web/img/**`
- `/js/**``[assets]/web/js/**`
- `/favicon.ico``[assets]/web/favicon.ico`
- `/android/img/**``[Application.dataDir]/**`

| URL | 静态资源 |
|:--------------------------:|:--------------------------:|
| `/``/index.html`、任何未定义的路由 | `[assets]/web/index.html` |
| `/assets/**` | `[assets]/web/assets/**` |
| `/font/**` | `[assets]/web/font/**` |
| `/img/**` | `[assets]/web/img/**` |
| `/js/**` | `[assets]/web/js/**` |
| `/favicon.ico` | `[assets]/web/favicon.ico` |
| `/android/img/**` | `[Application.dataDir]/**` |

要添加自定义路由及其处理逻辑,可在调用`createInstance()`前,为`customRoutingList`变量重新赋值一个包含自定义路由定义的`List`

Expand Down

0 comments on commit 4857521

Please sign in to comment.