Home  >  Q&A  >  body text

Method to display database data: use console.log(req)

<p>I ran <code>console.log(req);</code> to see what was there and found that the data from the database was displayed along with the session data</p> <pre class="brush:js;toolbar:false;">sessionStore: MySQLStore { . . . options: { host: 'localhost', user: 'root', password: '1324', database: 'dbso', endConnectionOnClose: true, clearExpired: true, checkExpirationInterval: 900000, expiration: 86400000, createDatabaseTable: true, connectionLimit: 1, charset: 'utf8mb4_bin', schema: [Object] }, . . . </pre> <p>I'm using <code>express-mysql-session</code> and <code>express-session</code></p> <pre class="brush:js;toolbar:false;">app.use(session({ secret: "sss", save: false, saveUninitialized: false, store: new mySQLStore({ /*database information*/ }) })); </pre> <p>My concern and doubt is how much should I worry about this, and if I need to worry, how can I fix it? </p> <p>Our website uses cookies to store user sessions. </p> <p>The summary of my question is, can req be viewed/obtained on the client side? </p>
P粉396248578P粉396248578438 days ago457

reply all(2)I'll reply

  • P粉639667504

    P粉6396675042023-09-01 00:54:03

    Looks like you are calling console.log from the Node process. Unless you do something really weird (like send this req object back to the client via http), the client won't see this.

    reply
    0
  • P粉704066087

    P粉7040660872023-09-01 00:18:56

    serial number

    The request object is used to pass data between middleware and endpoint handlers. It is only visible on the server.

    reply
    0
  • Cancelreply