Server-side WebAssembly with Express
Node.js can be used in several ways to add value to a WebAssembly project. In this section, we're going to walk through an example Node.js application that integrates WebAssembly. The application uses Express with some simple routes to call functions from a compiled Wasm module.
Overview of the project
The project reuses some of the code from the application we built in Chapter 7, Creating an Application from Scratch (Cook the Books) to demonstrate how Node.js can be used with WebAssembly. The code for this section is located in the /chapter-09-node/server-example
folder in the learn-webassembly
repository. We're going to review portions of the application directly applicable to Node.js. The following structure represents the file structure for the project:
├── /lib │ └── main.c ├── /src | ├── Transaction.js | ├── /assets | │ ├── db.json | │ ├── main.wasm | │ └── memory.wasm | ├── assign-routes.js | ├── index.js | └── load...