title: Use image path from postgres, to send image to front-end
body: <p>I am trying to send images to front-end (Vuejs) using a path stored in postgres.I'am using express.
  First, I want to know if it's the right way to send images to the front.</p>
  
  <p>app.js</p>
  
  <pre><code>const app = express();
  var fs = require('fs');
  var path = require('path');
  const db = require('./queries');
  
  var dir = path.join(__dirname, '../assets');
  console.log("DIR", dir);
  
  app.use(morgan('combined'));
  app.use(bodyParser.json());
  app.use(cors())
  
  app.get('/test', (req, res) =&gt; {
      res.send({
          message: `Hello you get that`
      })
  })
  
  app.get('/games', db.getGames)
  app.listen(process.env.PORT || 8081)
  </code></pre>
  
  <p>queries.js</p>
  
  <pre><code>const Pool = require('pg').Pool
  const pool = new Pool({
    user: 'postgres',
    host: 'localhost',
    database: 'TTTT',
    password: 'XXXX!',
    port: 5432,
  })
  
  const getGames = (request, response) =&gt; {
    pool.query('SELECT * FROM games ORDER BY name ASC', (error, results) =&gt; {
      if (error) {
        throw error
      }
      response.status(200).json(results.rows)
    })
  }
  module.exports = {
    getGames
  }
  </code></pre>
  
  <p>DB :</p>
  
  <p><a href="https://i.stack.imgur.com/fUF6k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fUF6k.png" alt="DB settings"></a></p>
  
  <p>To sum up, I want to use the path in "img" to serve it to the front.
  I hope I've been clear enough. (Sorry for my english)</p>