Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 1.25 KB

README.md

File metadata and controls

31 lines (19 loc) · 1.25 KB

Kotlin hello world for Cloudflare Workers

Your Kotlin code in main.kt, running on Cloudflare Workers

In addition to Wrangler v2.x you will need to install a JDK 8 or newer. The easiest way to do this is using the free Community Edition of IntelliJ IDEA.

Wrangler

Configure the wrangler.toml by filling in the account_id from the Workers pages of your Cloudflare Dashboard.

Further documentation for Wrangler can be found here.

Build & Deploy

After setting up your environment, run the following command:

./gradlew :compileProductionExecutableKotlinWasmJs

That will compile your code into a WebAssembly executable and JavaScript glue code, after which you can run wrangler deploy to push it to Cloudflare:

npx wrangler@latest deploy build/js/packages/kotlin-worker-hello-world-wasm-js/kotlin/kotlin-worker-hello-world.js

Learn more