Moving mysql connect into json route