I am reading this article on getting started with web assembly. I tried to write my code in js but when I run it I get this error in the client side console:
Uncaught ReferenceError: Module is not defined
My test.cpp file looks like this
#include <stdio.h>
#include <iostream>
using namespace std;
int test() {
return 0;
}
My index.html file looks like this
<!DOCTYPE html>
<html>
<!-- My Html Stuff -->
<script>
var testFunc = Module.cwrap(
'test',
null,
null
);
testFunc();
<script>
</html>
my app.js file looks lime this
const http = require('http')
, express = require('express')
, app = express()
, server = http.createServer(app);
server.listen(process.env.PORT || 80);
app.use(express.static(__dirname + '/views/'));
I start the process with node app but when I load localhost it gives me that error in my console.