Skip to content

Commit

Permalink
Merge branch 'main' of github.com:codeitlikemiley/service_template
Browse files Browse the repository at this point in the history
  • Loading branch information
codeitlikemiley committed Jun 12, 2024
2 parents fddb542 + fae27cc commit 2e071f8
Showing 1 changed file with 63 additions and 11 deletions.
74 changes: 63 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Note: Install the following before you can use the template generator.
- [cargo-generate](https://cargo-generate.github.io/cargo-generate/installation.html)
- [protoc](https://grpc.io/docs/protoc-installation/)
- [server_template](https://github.com/codeitlikemiley/server_template)
- [workspacer](https://github.com/codeitlikemiley/workspacer) (optional cli tools to manage rust workspace)

## GRPC Client

Expand All @@ -28,6 +29,34 @@ mkdir <workspace_root>
cd <workspace_root>
```

- [ ] Update workspace `Cargo.toml` file content below.

Note: The workspacer command above would generate this Code on `Cargo.toml`

```toml
[workspace]
resolver = "2"
members = [
server,
# add here services here after you generated it
auth, # example service
]
```

or you can download and install [workspacer cli](https://github.com/codeitlikemiley/workspacer) and use it to manage your workspace

```sh
mkdir <workspace_root>
workspacer init
# by default it has the server in the member
# to add more services
worspacer add services/auth
# you can also remove service
workspacer rm service/auth
# to view all current members of workspace
workspacer ls
```

Example Workspace Tree Structure
```sh
workspace (root)
Expand All @@ -50,23 +79,46 @@ workspace (root)

```

- [ ] Update workspace `Cargo.toml` file content below.
- [ ] Create the Server

```sh
cd <workspace_root>
cargo generate --git codeitlikemiley/server_template --name server
```

## Favorite The template

`~/.cargo/cargo-generate.toml` if this file dont exist please create it first `touch ~/.cargo/cargo-generate.toml`

- [ ] Create Folder for Templates

```sh
cd ~/.cargo
mkdir templates
cd templates
git clone https://github.com/codeitlikemiley/services_template
git clone https://github.com/codeitlikemiley/server_template
```

- [ ] Add to favorites [services_template](https://github.com/codeitlikemiley/services_template) and [server_template](https://github.com/codeitlikemiley/server_template)

```toml
[workspace]
resolver = "2"
members = [
server,
# add here services here after you generated it
auth, # example service
]
[values]
gh_username = "YOUR_USERNAME"
ide = "none|vscode"

[favorites.services]
path = "/Users/YOUR_USERNAME/.cargo/templates/services_template"

[favorites.server]
path = "/Users/YOUR_USERNAME/.cargo/templates/server_template/"
```

- [ ] Create the Server
- [ ] Generate Server and Services template with short cut

```sh
cd <workspace_root>
cargo generate --git codeitlikemiley/server_template --name server
cargo generate services --name auth
cargo generate server --name server
```


Expand Down

0 comments on commit 2e071f8

Please sign in to comment.