I have set up Apache
web server to proxy
node
applications in a virtualhost
environment.
I have an express
application that serves a static
web page:
app.use(express.static('.'))
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug')
function getMySQLConnection() {
return mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'pwd',
database : 'Persons'
});
}
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/mainpage.html'));
});
app.get('/OnAcceptTerms', function(req, res) {
...
});
app.listen(8066);
The mainpage.html
file is just a page that forces the user to accept terms. There is a checkbox
that says he accepts terms, and then a button
becomes active that allows him to proceed.
<body onload="disableSubmit()">
<input type="checkbox" name="terms" id="terms" onchange="activateButton(this)"> I Agree Terms & Coditions
<br><br>
<input type="button" name="submit" id="submit" value="Enter" onclick=window.location.assign('http://www.google.com')>
</center>
In the onclick=
method, how do I would like to pass control back to express
so that
app.get('/OnAcceptTerms',
code gets executed when the user clicks the button on the static web page?