Second State
  • What is Second State?
  • Server-side WebAssembly
    • Why?
      • WebAssembly vs native code
    • Getting started
      • VS Codespaces
      • The ssvmup tool
    • Rust functions in Node.js
    • Access system resources
      • WASI
      • The storage interface
      • The inference interface
    • Examples and use cases
      • Encryption and decryption
      • Machine learning
      • Artificial intelligence
    • SSVM Performance
  • Function as a Service
    • Getting started
      • Context
      • Send result to another service
    • Input and output
      • JSON argument
      • Binary argument
      • Multiple arguments
      • Argument from a URL
      • JSON return value
      • Binary return value
      • Redirect return value
    • Stateful execution
  • Related technologies
    • Deno, Rust and WebAssembly
    • A Rusty hello world
    • Rust and WebAssembly
    • WebAssembly in the browser
    • Access JavaScript from Rust
    • How to Learn Rust Without Installing Any Software
    • How to Publish a no-code website in 10 minutes
Powered by GitBook
On this page
  • This page is outdated. Please visit here to check out how to get started with Rust functions in Node.js with VSCode.
  • VS Codespaces steps

Was this helpful?

  1. Server-side WebAssembly
  2. Getting started

VS Codespaces

Get started with Rust functions in Node.js app without installing any software

PreviousGetting startedNextThe ssvmup tool

Last updated 4 years ago

Was this helpful?

This page is outdated. Please visit here to check out .

In the , we discussed how to create and access Rust functions in Node.js apps. In this tutorial, I will show you how to experiment with development without installing any developer tools software.

  • The Rust files are in the src directory. You can put high performance workload into Rust functions. The Rust build and dependency configuration is in the Cargo.toml file.

  • The JavaScript files are in the node directory and they can access the Rust functions.

    • The node/app.js file contains the application.

VS Codespaces steps

Next, create a new codespace. Put your forked repository into the Git Repository field. This step takes a few minutes. But once a codespace is created, subsequent openings only take seconds.

Open the source code files and make changes as you wish!

Click on the Run button on the left panel, and then the Launch Program at the top to build and run the application.

The Terminal window at the bottom shows the build progress. It builds the Rust program, and then launches the Node.js app.

The Debug window shows the Node.js server running and waiting for web requests.

Now, open another terminal window in the IDE via the Terminal -> New Terminal menu.

From the terminal window, you can test the local server.

$ curl http://127.0.0.1:3000/?name=SSVM
hello SSVM

That's it! VSCode has many useful features such as real time error detection and syntax highlighting as you type code, advanced Github integration, and integrations with many many development tools. Enjoy coding!

to get started. In your fork, you can use GitHub's web UI to edit source code files.

VS Codespaces runs entirely in your browser and costs around $1 per work day. It is cheaper than a cup of coffee in the office. Alternatively, in steps 1-2 below, you could use locally installed VSCode and Docker, and .

First, open the web site and login with your Azure account. You can get a .

In fact, you can run any Linux command from VSCode's built-in Terminal. You could run ssvmup build to build, and then node node/app.js to run the Node.js application. The Node.js application could be a server application as we have shown here, or simply a command line program as many of our .

Fork this GitHub repository
launch the IDE with your remote git repository
VSCode Codespaces
free Azure account
later examples
how to get started with Rust functions in Node.js with VSCode
previous tutorial
https://www.youtube.com/watch?v=j85cbNsciOs