feat: SPA sites
This commit is contained in:
@@ -105,36 +105,44 @@ PUT /{page}/
|
||||
X-Token (your API token)
|
||||
X-Host (optional host as entrypoint)
|
||||
X-Host-Only (optional host as entrypoint)
|
||||
X-SPA (optional SPA file)
|
||||
(body with tar data)
|
||||
```
|
||||
|
||||
```bash
|
||||
# create archive from 'dist' dir and upload it to /my-project/
|
||||
tar -czC dist -f dist.tar.gz .
|
||||
curl -X PUT \
|
||||
curl -v -X PUT \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
--data-binary "@dist.tar.gz" \
|
||||
https://stapler-host/my-project/
|
||||
|
||||
# same thing but one-liner
|
||||
tar -czC dist . | curl -X PUT \
|
||||
tar -czC dist . | curl -v -X PUT \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
--data-binary @- \
|
||||
https://stapler-host/my-project/
|
||||
|
||||
# make stapler server identifiers myproject.example.com and /my-project/
|
||||
tar -czC dist . | curl -X PUT \
|
||||
# make stapler server identify myproject.example.com and /my-project/
|
||||
tar -czC dist . | curl -v -X PUT \
|
||||
--data-binary @- \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
-H 'X-Host: myproject.example.com' \
|
||||
https://stapler-host/my-project/
|
||||
|
||||
# make stapler server identifiers myproject.example.com only
|
||||
tar -czC dist . | curl -X PUT \
|
||||
tar -czC dist . | curl -v -X PUT \
|
||||
--data-binary @- \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
-H 'X-Host-Only: myproject.example.com' \
|
||||
https://stapler-host/my-project/
|
||||
|
||||
# make a SPA site at /my-project/index.html
|
||||
tar -czC dist . | curl -v -X PUT \
|
||||
--data-binary @- \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
-H 'X-SPA: index.html' \
|
||||
https://stapler-host/my-project/
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
@@ -152,13 +160,13 @@ PUT /{page}/
|
||||
|
||||
```bash
|
||||
# create /my-project/ that redirects to https://github.com/my-project
|
||||
curl -X PUT \
|
||||
curl -v -X PUT \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
-H 'X-Redirect: https://github.com/my-project' \
|
||||
https://stapler-host/my-project/
|
||||
|
||||
# simple redirect from root host to www
|
||||
curl -X PUT \
|
||||
curl -v -X PUT \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
-H 'X-Proxy: https://www.my-website.com' \
|
||||
-H 'X-Host: my-website.com' \
|
||||
@@ -177,7 +185,7 @@ PUT /{page}/
|
||||
|
||||
```bash
|
||||
# create /my-website/ that proxies to http://host.containers.internal:8000
|
||||
curl -X PUT \
|
||||
curl -v -X PUT \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
-H 'X-Proxy: http://host.containers.internal:8000' \
|
||||
https://stapler-host/my-project/
|
||||
@@ -192,7 +200,7 @@ DELETE /{page}/
|
||||
|
||||
```bash
|
||||
# delete /my-project/
|
||||
curl -X DELETE \
|
||||
curl -v -X DELETE \
|
||||
-H 'X-Token: <TOKEN>' \
|
||||
https://stapler-host/my-project/
|
||||
```
|
||||
@@ -218,7 +226,7 @@ curl -X DELETE \
|
||||
- name: Create archive
|
||||
run: tar -czC dist -f dist.tar.gz .
|
||||
- name: Deploy to Stapler server
|
||||
run: curl -X PUT -H 'X-Token: ${{ secrets.STAPLER_TOKEN }}' -H 'X-Host: ${{ vars.TARGET_HOST }}' --data-binary "@dist.tar.gz" https://stapler-host/my-project/
|
||||
run: curl -v -X PUT -H 'X-Token: ${{ secrets.STAPLER_TOKEN }}' -H 'X-Host: ${{ vars.TARGET_HOST }}' --data-binary "@dist.tar.gz" https://stapler-host/my-project/
|
||||
```
|
||||
|
||||
### Redirecting hosts with DNS
|
||||
|
||||
Reference in New Issue
Block a user