From 9f7fd1a9f23b38ab2557fd28c2f3db2b343f781a Mon Sep 17 00:00:00 2001 From: Marco Zocca Date: Sun, 7 Jan 2024 16:49:17 +0100 Subject: [PATCH] saving --- README.md | 7 +++++++ index.html | 11 ++++++++++- server.js | 4 ++++ server.py | 0 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 server.py diff --git a/README.md b/README.md index 6039e7b..8bb440e 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,13 @@ Load the script from CDN into the head of your HTML file: ``` +and of course also HTMX and Plotly: + +```html + + +``` + ### Usage Add these attributes to a page element: diff --git a/index.html b/index.html index 0d39426..76565ef 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,16 @@ -

UPDATE

+ + +
+ + +
diff --git a/server.js b/server.js index c6b79ef..a449edd 100644 --- a/server.js +++ b/server.js @@ -10,12 +10,16 @@ app.use(morgan('combined')) // static files var public = path.join(__dirname, ''); app.use('/', express.static(public)); +// url-encoded forms +const bodyParser = require('body-parser'); +app.use(bodyParser.urlencoded({ extended: true })); app.get('/', (req, res) => { res.sendFile(path.join(public, 'index.html')); }); app.post('/get-data', (req, res) => { + console.log('form data: '+JSON.stringify(req.body)) // form data const n = 3; const x = Array.from({length: n}, (_, i) => i ); const y = Array.from({length: n}, () => Math.floor(Math.random() * 10) ); diff --git a/server.py b/server.py new file mode 100644 index 0000000..e69de29