// Import modules
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var path = require('path');
var http = require('http').Server(app);
var mysql = require("mysql");

var con = mysql.createConnection({
	host: "localhost",
	database: "shrtlnco",
	user: "root",
	password: "shrtlnco"
});

con.connect(function(err){
  if(err){
    console.log('Error connecting to Db');
    return;
  }
  console.log('Connection established');
});

con.end(function(err) {
  // The connection is terminated gracefully
  // Ensures all previously enqueued queries are still
  // before sending a COM_QUIT packet to the MySQL server.
});
// Get all files
app.use(express.static(path.join(__dirname, 'public')));

app.get('/', function(req, res) {
    res.sendFile(__dirname + '/index.html');
});


app.use(bodyParser.urlencoded());

app.post('/link', function (req, res, next) {
  var data = myFunction(req.body);
  res.json(data);
});

// Listen on port 7002
http.listen(7002, function() {
    console.log('listening on port 7002');
});

@@ -846,16 +846,36 @@
 encoded(
+%7B%0A  extended: true%0A%7D
 ));%0A%0Aapp

test post