diff options
mascara - rename things + break out mascara asset server
Diffstat (limited to 'mascara/example')
-rw-r--r-- | mascara/example/app.js (renamed from mascara/example/index.js) | 0 | ||||
-rw-r--r-- | mascara/example/app/index.html (renamed from mascara/example/index.html) | 4 | ||||
-rw-r--r-- | mascara/example/server.js | 31 |
3 files changed, 32 insertions, 3 deletions
diff --git a/mascara/example/index.js b/mascara/example/app.js index aae7ccd19..aae7ccd19 100644 --- a/mascara/example/index.js +++ b/mascara/example/app.js diff --git a/mascara/example/index.html b/mascara/example/app/index.html index 47d6da34f..02323e5f9 100644 --- a/mascara/example/index.html +++ b/mascara/example/app/index.html @@ -3,15 +3,13 @@ <html lang="en"> <head> <meta charset="utf-8"> - <title>MetaMask ZeroClient Example</title> - + <script src="http://localhost:9001/metamascara.js"></script> </head> <body> <button class="action-button-1">SYNC TX</button> <button class="action-button-2">ASYNC TX</button> - <script src="./zero.js"></script> <script src="./app.js"></script> </body> </html>
\ No newline at end of file diff --git a/mascara/example/server.js b/mascara/example/server.js new file mode 100644 index 000000000..d39c19600 --- /dev/null +++ b/mascara/example/server.js @@ -0,0 +1,31 @@ +const express = require('express') +const createMetamascaraServer = require('../server/') +const createBundle = require('../server/util').createBundle +const serveBundle = require('../server/util').serveBundle + +// +// Iframe Server +// + +const mascaraServer = createMetamascaraServer() + +// start the server +const mascaraPort = 9001 +mascaraServer.listen(mascaraPort) +console.log(`Mascara service listening on port ${mascaraPort}`) + + +// +// Dapp Server +// + +const dappServer = express() + +// serve dapp bundle +serveBundle(dappServer, '/app.js', createBundle(require.resolve('./app.js'))) +dappServer.use(express.static(__dirname + '/app/')) + +// start the server +const dappPort = '9002' +dappServer.listen(dappPort) +console.log(`Dapp listening on port ${dappPort}`) |