11# Getting Started
2+
23This section will help you bring spa-server up, and upload your static web files to it.
34
45## Run spa-server by docker
6+
57` uploading file ` feature needs spa-server open admin-server. So we should create a config file first.
68
79``` bash
@@ -22,11 +24,15 @@ ghcr.io/fornetcode/spa-server:latest
2224```
2325
2426## Run spa-client in npm project
27+
25281 . Install spa-client npm package.
29+
2630``` shell
2731npm install spa-client dotenv --save-dev
2832```
33+
29342 . add config for spa-client in the ` .env ` file
35+
3036```
3137# all config start with `SPA` for spa-client
3238SPA_SERVER_ADDRESS=http://127.0.0.1:9000
@@ -37,20 +43,35 @@ SPA_SERVER_AUTH_TOKEN=token
3743SPA_UPLOAD_PARALLEL=3
3844```
3945
40- 3 . Add script to package.json (need ` dotenv ` ). ` www.example.com ` is the domain of your website, and ` ./build ` is directory of static web files.
46+ 3 . Add script to package.json (need ` dotenv ` ). ` www.example.com ` is the domain of your website, and ` ./build ` is
47+ directory of static web files.
4148
4249``` json
4350{
44- "script" :{
45- "upload" : " dotenv .env spa-client upload ./build www.example.com" ,
46- "release" :" dotenv .env spa-client release www.example.com"
51+ "script" : {
52+ "upload" : " dotenv .env spa-client upload ./build www.example.com" ,
53+ "release" : " dotenv .env spa-client release www.example.com"
4754 }
4855}
4956```
5057
58+ we also support serving multiple SPA in one domain:
59+
60+ ``` json
61+ {
62+ "script" : {
63+ "upload1" : " dotenv .env spa-client upload ./build www.example.com/a" ,
64+ "release1" : " dotenv .env spa-client release www.example.com/a" ,
65+ "upload2" : " dotenv .env spa-client upload ./build www.example.com/b" ,
66+ "release2" : " dotenv .env spa-client release www.example.com/b"
67+ }
68+ }
69+ ```
5170
5271## What's More
53- - a React example for spa-client: [ js-app-example] ( https://github.com/fornetcode/spa-server/blob/master/example/js-app-example/README.md ) .
72+
73+ - a React example for
74+ spa-client: [ js-app-example] ( https://github.com/fornetcode/spa-server/blob/master/example/js-app-example/README.md ) .
5475- spa-server [ configuration] ( ./spa-server-configuration.md ) and its admin-server [ http api] ( ./spa-server-api.md )
5576- spa-client [ npm package] ( ./spa-client-npm-package.md )
5677
0 commit comments