title: send data from db with and api build with express-generator code 200 no data
body: <p>my database in mongoDb is connected to my nodeJS i can read it there my nodeJs api is connected to my client-side (in reactJS) and i can send data from my  nodeJs api using express-generator to my client-side and is working but when i tried to send my mongoDb database to the client-side is not working( but i'm still getting status 200 but my array is not here . I can't figure out why? i cant see the db when i call the api in postman so i assume the error is in the server-side . If i had a consol.log i can see the db but when i use return it is not working and i cant see the data in postman 
  here my nodeJs code: </p>
  
  <pre><code>var mongodb = require('mongodb')
  var MongoClient = mongodb.MongoClient
  var connectionURL = 'mongodb://127.0.0.1:27017'
  var databaseName = 'projet_Ecommerce';
  const dataFromDb = () =&gt; {
  
  
  
      MongoClient.connect(connectionURL, {
          useNewUrlParser: true
      }, (error, client) =&gt; {
          if (error) {
              return console.log('Unable to connect to database')
          }
          console.log('Connected correctly !');
  
          var db = client.db(databaseName)
          db.collection('product').find().toArray(function(error, data) {
              if (error) {
                  return console.log('Unable to find the user')
              }
  
              return (data);
  
          })
          // Pointer - go to doc
          // db.collection('tasks').find({completed: false}).toArray()
      })
  };
  
  module.exports = dataFromDb
  
  routres / index.js:
  
      var express = require('express');
  var router = express.Router();
  const bodyParser = require('body-parser')
  var dataC = require('../public/javascripts/dataFromDb')
  // data = JSON.stringify(data);
  // console.log(dataFromDb())
  /* GET home page. */
  router.get('/', function(req, res, next) {
  
      //console.log(dataFromDb())
      res.send(dataC())
  
  });
  
  //console.log(dataFromDb())
  module.exports = router;
  </code></pre>
  
  <p>app.js:</p>
  
  <pre><code>
  var createError = require('http-errors');
  var express = require('express');
  var path = require('path');
  var cookieParser = require('cookie-parser');
  var logger = require('morgan');
  var cors = require("cors")
  var indexRouter = require('./routes/index');
  var usersRouter = require('./routes/users');
  var testAPIRouter = require("./routes/testAPI");
  var app = express();
  var bodyParser = require("body-parser")
  
  // view engine setup
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'jade');
  app.use(cors());
  app.use(logger('dev'));
  app.use(express.json());
  // app.use(bodyParser.urlencoded({ extended: true }));
  app.use(express.urlencoded({
      extended: false
  }));
  app.use(cookieParser());
  app.use(express.static(path.join(__dirname, 'public')));
  
  app.use('/', indexRouter);
  app.use('/users', usersRouter);
  app.use("/testAPI", testAPIRouter);
  // catch 404 and forward to error handler
  app.use(function(req, res, next) {
      next(createError(404));
  });
  
  // error handler
  app.use(function(err, req, res, next) {
      // set locals, only providing error in development
      res.locals.message = err.message;
      res.locals.error = req.app.get('env') === 'development' ? err : {};
  
      // render the error page
      res.status(err.status || 500);
      res.render('error');
  });
  
  module.exports = app;
  </code></pre>
  
  <p>other files no change </p>