Skip to content

Commit 2e071f8

Browse files
Merge branch 'main' of github.com:codeitlikemiley/service_template
2 parents fddb542 + fae27cc commit 2e071f8

File tree

1 file changed

+63
-11
lines changed

1 file changed

+63
-11
lines changed

Diff for: README.md

+63-11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Note: Install the following before you can use the template generator.
1010
- [cargo-generate](https://cargo-generate.github.io/cargo-generate/installation.html)
1111
- [protoc](https://grpc.io/docs/protoc-installation/)
1212
- [server_template](https://github.com/codeitlikemiley/server_template)
13+
- [workspacer](https://github.com/codeitlikemiley/workspacer) (optional cli tools to manage rust workspace)
1314

1415
## GRPC Client
1516

@@ -28,6 +29,34 @@ mkdir <workspace_root>
2829
cd <workspace_root>
2930
```
3031

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+
3160
Example Workspace Tree Structure
3261
```sh
3362
workspace (root)
@@ -50,23 +79,46 @@ workspace (root)
5079

5180
```
5281

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)
54104

55105
```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/"
63115
```
64116

65-
- [ ] Create the Server
117+
- [ ] Generate Server and Services template with short cut
66118

67119
```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
70122
```
71123

72124

0 commit comments

Comments
 (0)