@explorable-viz/fluid
Version:
A functional programming language which integrates a bidirectional dynamic analysis, connecting outputs to data sources in a fine-grained way. Fluid is implemented in PureScript and runs in the browser.
42 lines (36 loc) • 1.04 kB
JavaScript
const express = require('express');
const serve = require('express-static');
require('http-shutdown').extend();
const app = express();
const root = process.cwd() + '/dist/' + process.argv[2];
app.use(serve(root));
const server = app.listen(8080, function() {
console.log("Serving content from " + root);
}).withShutdown();
(async () => {
try {
if (process.argv.length == 4) {
module = process.cwd() + process.argv[3];
} else {
module = root + '/test.mjs';
}
console.log('Loading Puppeteer test module:', module);
import(module).then(({ main }) => {
main().then(serverDown);
}).catch(err => {
console.error("Failed to load PureScript output:", err);
});
} catch (error) {
console.error('Error:', error);
}
})();
function serverDown() {
console.log('Shutting down server')
server.shutdown(function(err) {
if (err) {
return console.log('shutdown failed', err.message);
}
console.log('Everything is cleanly shut down.');
});
}