Apos refatorar , dá erro ao tentar pegar a conexao
var mysql = require('mysql');
module.exports = function(){
return = mysql.createConnection({
host:'localhost',
user:'root',
password:'123456',
database:'casacodigo'
});
}
I:\desenvolvimento\workspaces\work_web\work_node_js\teste-node\casadocodigo\app\infra\dbConnection.js:4
return = mysql.createConnection({
^
SyntaxError: Unexpected token =
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (I:\desenvolvimento\workspaces\work_web\work_node_js\teste-node\casadocodigo\app\routes\produtos.js:3:20)
at Module._compile (module.js:571:32)
[nodemon] app crashed - waiting for file changes before starting...