https://github.com/yoav-lavi/deno-deploy-rust-template
A template for creating Deno Deploy projects in Rust
https://github.com/yoav-lavi/deno-deploy-rust-template
deno deno-deploy rust template
Last synced: about 1 year ago
JSON representation
A template for creating Deno Deploy projects in Rust
- Host: GitHub
- URL: https://github.com/yoav-lavi/deno-deploy-rust-template
- Owner: yoav-lavi
- License: apache-2.0
- Created: 2022-07-03T16:13:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-24T19:58:05.000Z (almost 4 years ago)
- Last Synced: 2025-03-25T04:34:59.690Z (about 1 year ago)
- Topics: deno, deno-deploy, rust, template
- Language: Rust
- Homepage:
- Size: 55.7 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
deno-deploy-rust-template
A template for creating Deno Deploy projects in Rust
## Prerequisites
- [`cargo-generate`](https://github.com/cargo-generate/cargo-generate)
- [`cargo-make`](https://github.com/sagiegurari/cargo-make#installation)
Prerequisites for usage without cargo-make
## Usage
> **Note**
>
> If using `cargo make`, any commands requiring `deno` will attempt to install `deno` via `cargo`, if it is not already installed and in your `$PATH`.
> If you want to install `deno` via other means and haven't already, do so before running any `cargo make` commands.
### Using this template
```sh
cargo generate gh:yoav-lavi/deno-deploy-rust-template
```
### Building your project
```sh
cargo make build-wasm
```
Manual command
rustup target add wasm32-unknown-unknown
&& cargo build --release --target wasm32-unknown-unknown
&& wasm-bindgen target/wasm32-unknown-unknown/release/{{crate_name}}.wasm --target deno --out-dir build/
### Deploying to Deno Deploy
> **Note**
>
> Create a new token in the Deno Deploy (under "Access Tokens") and use it in place of `...` in `DENO_DEPLOY_TOKEN=...`
>
> If `~/.deno/bin` is not in your `$PATH`, you will need to add it for this command to work
```sh
DENO_DEPLOY_TOKEN=... cargo make deploy
```
Manual command
deployctl deploy --token=... --project={{deno-deploy-project-name}} src/index.ts --exclude "target/"
### Running your project with Deno
```sh
cargo make run
```
Manual command
deno run --allow-read --allow-net --allow-env src/index.ts
### Running tests
```sh
cargo make test-rust
cargo make test-integration
```
Manual command
cargo test --target wasm32-unknown-unknown
deno test --allow-read --allow-net --allow-env tests/integration.ts