Skip to content

Demonstrates integration of Rust code in Node.js using WebAssembly (WASM), with step-by-step setup instructions.

Notifications You must be signed in to change notification settings

NajamShehzad/rust-wasm-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Rust-NodeJS Integration Example

This repository demonstrates how to integrate Rust and Node.js using WebAssembly.

Structure

  • rust/: Contains the Rust code.
  • node/: Contains the Node.js code that uses the WebAssembly module generated from the Rust code.

Setup

Rust

  1. Navigate to the rust directory:

    cd rust 
  2. Build the Rust project using wasm-pack:

    wasm-pack build --target nodejs 
  3. Copy the pkg directory to the node directory.

    cp -r pkg ../node/

Node

  1. Navigate to the node directory:

    cd ../node 
  2. Build the Rust project using wasm-pack:

    npm install 
  3. Run the Node.js script:

    ts-node ./index.ts

About

Demonstrates integration of Rust code in Node.js using WebAssembly (WASM), with step-by-step setup instructions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published