Hi all
I have got some great help so far, i am using manychat and got a webhook to connect to my glitch.com app and run the database connection, now the thing i need to know now if someone can please help me is how to i pass a request and get the data and add that to the sql query
thanks in advance
this is my code thus far
// server.js
// where your node app starts
// init project
var express = require('express');
var app = express();
const requestPromise = require('request-promise');
// we've started you off with Express,
// but feel free to use whatever libs or frameworks you'd like through `package.json`.
app.use(express.static('public'));
// http://expressjs.com/en/starter/basic-routing.html
app.get("/", function (request, response) {
response.sendFile(__dirname + '/index.html');
});
//=======================================================================================
// Get the Client data from database
//=======================================================================================
app.get("/Getcompany", function (request, response) {
const mysql = require('mysql');
const connection = mysql.createConnection({
host: '**.**.**.**',
user: '*****',
password: '*******',
database: '*******'
});
connection.connect((err) => {
if (err) throw err;
console.log('Connected!');
});
});
// listen for requests :)
var listener = app.listen(process.env.PORT, function () {
console.log('Your app is listening on port ' + listener.address().port);
});
MOD EDIT: formatting