@@ -10,6 +10,7 @@ Note: Install the following before you can use the template generator.
10
10
- [ cargo-generate] ( https://cargo-generate.github.io/cargo-generate/installation.html )
11
11
- [ protoc] ( https://grpc.io/docs/protoc-installation/ )
12
12
- [ server_template] ( https://github.com/codeitlikemiley/server_template )
13
+ - [ workspacer] ( https://github.com/codeitlikemiley/workspacer ) (optional cli tools to manage rust workspace)
13
14
14
15
## GRPC Client
15
16
@@ -28,6 +29,34 @@ mkdir <workspace_root>
28
29
cd < workspace_root>
29
30
```
30
31
32
+ - [ ] Update workspace ` Cargo.toml ` file content below.
33
+
34
+ Note: The workspacer command above would generate this Code on ` Cargo.toml `
35
+
36
+ ``` toml
37
+ [workspace ]
38
+ resolver = " 2"
39
+ members = [
40
+ server,
41
+ # add here services here after you generated it
42
+ auth, # example service
43
+ ]
44
+ ```
45
+
46
+ or you can download and install [ workspacer cli] ( https://github.com/codeitlikemiley/workspacer ) and use it to manage your workspace
47
+
48
+ ``` sh
49
+ mkdir < workspace_root>
50
+ workspacer init
51
+ # by default it has the server in the member
52
+ # to add more services
53
+ worspacer add services/auth
54
+ # you can also remove service
55
+ workspacer rm service/auth
56
+ # to view all current members of workspace
57
+ workspacer ls
58
+ ```
59
+
31
60
Example Workspace Tree Structure
32
61
``` sh
33
62
workspace (root)
@@ -50,23 +79,46 @@ workspace (root)
50
79
51
80
```
52
81
53
- - [ ] Update workspace ` Cargo.toml ` file content below.
82
+ - [ ] Create the Server
83
+
84
+ ``` sh
85
+ cd < workspace_root>
86
+ cargo generate --git codeitlikemiley/server_template --name server
87
+ ```
88
+
89
+ ## Favorite The template
90
+
91
+ ` ~/.cargo/cargo-generate.toml ` if this file dont exist please create it first ` touch ~/.cargo/cargo-generate.toml `
92
+
93
+ - [ ] Create Folder for Templates
94
+
95
+ ``` sh
96
+ cd ~ /.cargo
97
+ mkdir templates
98
+ cd templates
99
+ git clone https://github.com/codeitlikemiley/services_template
100
+ git clone https://github.com/codeitlikemiley/server_template
101
+ ```
102
+
103
+ - [ ] Add to favorites [ services_template] ( https://github.com/codeitlikemiley/services_template ) and [ server_template] ( https://github.com/codeitlikemiley/server_template )
54
104
55
105
``` toml
56
- [workspace ]
57
- resolver = " 2"
58
- members = [
59
- server,
60
- # add here services here after you generated it
61
- auth, # example service
62
- ]
106
+ [values ]
107
+ gh_username = " YOUR_USERNAME"
108
+ ide = " none|vscode"
109
+
110
+ [favorites .services ]
111
+ path = " /Users/YOUR_USERNAME/.cargo/templates/services_template"
112
+
113
+ [favorites .server ]
114
+ path = " /Users/YOUR_USERNAME/.cargo/templates/server_template/"
63
115
```
64
116
65
- - [ ] Create the Server
117
+ - [ ] Generate Server and Services template with short cut
66
118
67
119
``` sh
68
- cd < workspace_root >
69
- cargo generate --git codeitlikemiley/server_template --name server
120
+ cargo generate services --name auth
121
+ cargo generate server --name server
70
122
```
71
123
72
124
0 commit comments