1
1
# Getting Started
2
+
2
3
This section will help you bring spa-server up, and upload your static web files to it.
3
4
4
5
## Run spa-server by docker
6
+
5
7
` uploading file ` feature needs spa-server open admin-server. So we should create a config file first.
6
8
7
9
``` bash
@@ -22,11 +24,15 @@ ghcr.io/fornetcode/spa-server:latest
22
24
```
23
25
24
26
## Run spa-client in npm project
27
+
25
28
1 . Install spa-client npm package.
29
+
26
30
``` shell
27
31
npm install spa-client dotenv --save-dev
28
32
```
33
+
29
34
2 . add config for spa-client in the ` .env ` file
35
+
30
36
```
31
37
# all config start with `SPA` for spa-client
32
38
SPA_SERVER_ADDRESS=http://127.0.0.1:9000
@@ -37,20 +43,35 @@ SPA_SERVER_AUTH_TOKEN=token
37
43
SPA_UPLOAD_PARALLEL=3
38
44
```
39
45
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.
41
48
42
49
``` json
43
50
{
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"
47
54
}
48
55
}
49
56
```
50
57
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
+ ```
51
70
52
71
## 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 ) .
54
75
- spa-server [ configuration] ( ./spa-server-configuration.md ) and its admin-server [ http api] ( ./spa-server-api.md )
55
76
- spa-client [ npm package] ( ./spa-client-npm-package.md )
56
77
0 commit comments