mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-05 20:41:44 -07:00
feat: static file server
this lets you host web apps out of :9993/app/{app_name} :9993/app/{other_app} from $ZT_HOME/app/{app_name}
This commit is contained in:
parent
6be0e67a5c
commit
b4eb39fb16
3 changed files with 124 additions and 5 deletions
20
README.md
20
README.md
|
@ -175,3 +175,23 @@ Metrics are also available on disk in ZeroTier's working directory:
|
|||
| zt_peer_packet_errors | node_id | Counter | number of incoming packet errors from a peer |
|
||||
|
||||
If there are other metrics you'd like to see tracked, ask us in an Issue or send us a Pull Request!
|
||||
|
||||
### HTTP / App server
|
||||
|
||||
There is a static http file server suitable for hosting Single Page Apps at http://localhost:9993/app/<app-path>
|
||||
|
||||
Use `zerotier-cli info -j` to find your zerotier-one service's homeDir
|
||||
|
||||
``` sh
|
||||
cd $ZT_HOME
|
||||
sudo mkdir -p app/app1
|
||||
sudo mkdir -p app/appB
|
||||
echo '<html><meta charset=utf-8><title>appA</title><body><h1>hello world A' | sudo tee app/appA/index.html
|
||||
echo '<html><meta charset=utf-8><title>app2</title><body><h1>hello world 2' | sudo tee app/app2/index.html
|
||||
curl -sL http://localhost:9993/app/appA http://localhost:9993/app/app2
|
||||
```
|
||||
|
||||
Then visit [http://localhost:9993/app/app1/](http://localhost:9993/app/app1/) and [http://localhost:9993/app/appB/](http://localhost:9993/app/appB/)
|
||||
|
||||
Requests to paths don't exist return the app root index.html, as is customary for SPAs.
|
||||
If you want, you can write some javascript that talks to the service or controller [api](https://docs.zerotier.com/service/v1).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue