HTML file contains the following form:
<form action="/insertHolding" method="POST">
<label for="hodl">Hodl</label><br>
<input type="text" id="hodl" name="hodl"><br>
<input type="submit" value="Submit">
</form>
In order to get the POST action from clicking the Submit button of the form, you must have the following
code in the app.js file:
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.post('/insertHolding', function (req,res) {
db.query("INSERT INTO posessions (coin,amount) VALUES ('BTC',?)",[req.body.hodl], function (err,result) {
There is no | |