Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 1.97 KB

README.md

File metadata and controls

83 lines (56 loc) · 1.97 KB

Cloudflare Workers Web App

Simple web app example for Cloudflare workers.

Built with waserv

Cloudflare Workers + WASM + Rust = ❤️

API Endpoints

  • GET / {"message":"Hello, World!"}
  • GET /hello/mehmetcan {"message":"Hello, mehmetcan!"}

Install

  1. Install Rust
  2. Install Wrangler
  3. Install wasm-pack
# Install wasm-pack
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wrangler generate cf-wasm-worker-name https://github.com/mehmetcansahin/cf-workers-web-app.git
cd cf-wasm-worker-name

Development

  1. wrangler dev

Benchmark

$ ab -c 10 -n 1000 https://cloudflare_worker_url/

Requests: 1k Median CPU Time: 0.7ms

👷‍♀️🦀🕸️ rustwasm-worker-template

A template for kick starting a Cloudflare worker project using wasm-pack.

This template is designed for compiling Rust libraries into WebAssembly and publishing the resulting worker to Cloudflare's worker infrastructure.

🔋 Batteries Included

🚴 Usage

🐑 Use wrangler generate to Clone this Template

Learn more about wrangler generate here.

wrangler generate wasm-worker  https://github.com/cloudflare/rustwasm-worker-template.git
cd wasm-worker

🛠️ Build with wasm-pack build

wasm-pack build

🔬 Test in Headless Browsers with wasm-pack test

wasm-pack test --headless --firefox