diff --git a/app.js b/app.js index 5ecb801..aefd640 100644 --- a/app.js +++ b/app.js @@ -21,6 +21,8 @@ const app = express(); var cors = require('cors'); app.use(cors()); +app.use(require('body-parser').urlencoded({ extended: false })); + // Verify the the dot utility is available at startup // instead of waiting for a first request. //fs.accessSync('/usr/bin/dot', fs.constants.X_OK); @@ -31,9 +33,22 @@ app.get('/', (req, res) => { // [START cloudrun_system_package_handler] // [START run_system_package_handler] -app.get('/tslsynth', (req, res) => { +app.post('/tslsynth', function(req, res){ + var tsl = req.body.tsl; + var target = req.body.target; + var user = req.body.user; + + console.log("User ID:") + console.log(user); + + console.log("tslSpec:"); + console.log(tsl); + + console.log("target:") + console.log(target); + try { - const synthResult = createDiagram(req.query.tsl, req.query.target); + const synthResult = createDiagram(tsl, target); res.setHeader('Content-Type', 'text/plain'); res.setHeader('Cache-Control', 'public, max-age=86400'); res.send(synthResult); @@ -48,9 +63,13 @@ app.get('/tslsynth', (req, res) => { } }); -app.get('/tslminrealizable', (req, res) => { +app.post('/tslminrealizable', (req, res) => { + console.log("User ID:") + console.log(req.body.user); + try { - const synthResult = createMinDiagram(req.query.tsl); + const synthResult = createMinDiagram(req.body.tsl); + res.setHeader('Content-Type', 'text/plain'); res.setHeader('Cache-Control', 'public, max-age=86400'); res.send(synthResult); @@ -88,7 +107,7 @@ const createDiagram = (tsl, target) => { input: tsl, }); - console.log("synthResult"); + console.log("synthResult:"); console.log(String(synthResult)); return synthResult; diff --git a/docs/index.html b/docs/index.html index a99ea1d..5dd4f64 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7,24 +7,19 @@ TSL Synth + + - diff --git a/package.json b/package.json index a83eb2e..581c199 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ }, "dependencies": { "cors": "^2.8.5", - "express": "^4.17.1" + "express": "^4.17.1", + "body-parser": "^1.15.2" }, "devDependencies": { "google-auth-library": "^7.0.0",