NLESC-JCER / cpp2wasm

Guide to make C++ available as a web application
https://nlesc-jcer.github.io/cpp2wasm/
Apache License 2.0
22 stars 6 forks source link

JavaScript web service using Emscripten and WebAssembly #83

Closed fdiblen closed 4 years ago

fdiblen commented 4 years ago

We would like to reorganize the guide and have several chapters. See the link below for the outline (README.outline.md): https://github.com/NLESC-JCER/cpp2wasm/pull/71/files#diff-20b48d680d0cbd36f087c68e1a55b61d

In this chapter, we will talk about emscripten, how we generate WebAssembly code and how we use it.

sverhoeven commented 4 years ago

Use expressjs as framework.

To install and run do

npm install --no-save expressjs
node expressjs/service.js

Content expressjs/service.js

const express = require('express')
const app = express()
const port = 3000

// TODO root find function hosted at /

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))

Test with curl

sverhoeven commented 4 years ago

Decided to use Fastify as web framework as it supports async/await and JSON schemas.