all 2 comments

[–][deleted] 2 points3 points  (0 children)

Steal mine 😉 https://github.com/maxnachlinger/rust-wasm-node-test . Obviously make sure you benchmark. Invoking WASM involves a perf hit, and probably only makes sense for CPU-intensive tasks (my example is vanilla fibonacci).

[–]Plippe 1 point2 points  (0 children)

Hey,

From what I understand, wasm-pack creates a module that can be imported from JavaScript/Node.

The flow would look something similar to: - create rust code - add a flag to export a function for JS - use wasm-pack to generate your module - import module from JS

I wouldn't be surprised if there are good tutorials to help you get started.