I really don't understand why this is occuring. I can create pool connections no problem without the use of app.use(express'static('public'));
- the results show up in the Heroku console.
However, when I include this line to serve static files - nothing occurs in console. I am using Heroku - is it possible that this may be part of the issue? Or is this something obvious about Express that I'm missing?
var express = require('express');
var app = express();
var fs = require('fs');
var path = require('path');
var mysql = require('mysql');
var pool = mysql.createPool({
connectionLimit: 10,
host:'*******',
user:'*******',
password:'*******',
database:'*******'
});
app.use(express.static('public'));
app.get('/',function(req,res){
pool.query("*********", function(err, rows, fields) {
if (err) throw err;
console.log(rows[0]);
});
});
app.listen(process.env.PORT || 3000);
Project is stored as public/index.html with files in sub-directories.