Creating Rust Functions in Node.js with SSVM and Docker
Prateek Jain
Posted on August 28, 2020
I recently came across SSVM with which we can easily create an app with Rust functions. I followed these steps for creating the application:
1. Creating the development environment with Docker
Get the code
$ git clone https://github.com/second-state/ssvm-nodejs-starter
$ cd ssvm-nodejs-starter
Run Docker container
$ docker pull secondstate/ssvm-nodejs-starter:v1
$ docker run -p 8080:8080 --rm -it -v $(pwd):/app secondstate/ssvm-nodejs-starter:v1
(docker) $ cd /app
2. Create an application
Copy the example application
https://github.com/second-state/wasm-learning/tree/master/nodejs/quadratic
Replace files in the sample application and build
$ ssvmup build
$ npm install express # The application requires the Express framework in Node.js
$ node node/server.js
3. Run application in the browser and check
From the web browser, go to http://localhost:8080/ to access this application.
Posted on August 28, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.