A batteries included template for kick starting a AssemblyScript Cloudflare worker project. The template is based on the TypeScript template, so uses TypeScript for the request handler.
🔋 Getting Started
To generate using
wrangler, run this command:
wrangler generate my-asc-project https://github.com/JamesLMilner/worker-assemblyscript-template
👩 💻 Developing
For your AssemblyScript code you can edit
assembly/index.ts and call
npm run asbuild to see your changes. To build the whole worker you can do
npm run build, which will build your TypeScript and AssemblyScript.
This template comes with mocha tests which simply test that the request handler can handle each request method.
npm test will run your tests.
This template uses
prettier to format the project. To invoke, run
npm run format.
👀 Previewing and Publishing
For information on how to preview and publish your worker, please see the
service-worker-mock used by the tests is not a perfect representation of the Cloudflare Workers runtime. It is a general approximation. We recommend that you test with
wrangler preview and in a staging environment to test things before deploying.
This template is in turn based off of the Cloudflare TypeScript template available here.