Method to display database data: use console.log(req)
P粉396248578
2023-08-31 08:47:42
<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>
Looks like you are calling
console.log
from the Node process. Unless you do something really weird (like send thisreq
object back to the client via http), the client won't see this.serial number
The request object is used to pass data between middleware and endpoint handlers. It is only visible on the server.