Skip to content

floherent/wasm-service

Repository files navigation

WASM Service

Standalone API service for running WebAssembly (or WASM) modules generated by Coherent Spark.

Disclaimer

The underlying content of this project comprises a sample service (not a product) that demonstrates how to run WASM modules once sparkified. The codebase should serve as a reference for developers who wish to integrate WASM modules into their own Node applications.

Getting started

This documentation assumes that you are a developer and familiar with Coherent Spark. Otherwise, visit the User Guide site to learn more about it.

Spark enables some powerful features for your Excel models. Among them is the ability to convert them to web assembly modules. That is, once an Excel model is sparkified, Spark generates a WASM representation of that model that you can later download and use in your own application independently.

Yes, that's right... the sky is the limit!

The following steps will guide you through the process of running the wasm-service and executing that WASM module within your own application.

Running the service

There are two ways to run this service:

  • via Docker
  • or using Node on your local machine (or on remote server)

Choose the one that best suits your needs. Refer to the Developer Guide for more technical details.

Running the service locally

This API service is built with Node and Express. Instructions on how to install Node can be found on its official website.

Once Node is installed, use a copy of this repository to install the dependencies and start the service.

# install dependencies
$ npm install # or yarn

# start the development server
$ npm run start # or yarn start

Launching the service via Docker

You can either build a docker image from the codebase (see Dockerfile) or pull the docker image for this service directly from Docker Hub. To run it, you will need to have Docker installed on your machine.

# build docker image
$ docker image build -t wasm-service .

# run the service via docker
$ docker container run --name wasm-service -p 8080:8080 -d wasm-service

By default, the service will be available on port 8080. You can change that by modifying the configuration file.

API reference

The wasm-service API includes five basic use cases to help you get started:

Use Cases Resources
API Documentation GET /docs or GET /docs-json
Upload a WASM module PUT /v1/services[/{version_id}]
Execute a WASM module POST /v1/services/{version_id}/execute
Get the WASM execution history GET /v1/services/{version_id}/history
Download a WASM module GET /v1/services/{version_id}
Delete a WASM module DELETE /v1/services/{version_id}

Additionally, the service contains a health check endpoint to verify that the service is up and running: GET /health.

Find more details about the API endpoints in the API reference section of the Developer Guide and the Postman collection.

Change log

See the CHANGELOG for all notable changes and release notes about this project.

Support

Please contact [email protected] with any questions or feedback.

Copyright and licensing

MIT-licensed.

About

Sample API service for running WASM files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages