Extending express (NodeJS)

function(accessToken, refreshToken, profile, done) {
// Here you want to lookup or create the user in the database
/* User.findOrCreate(…, function(err, user) {
if (err) { return done(err); }
done(null, user);
}); */
}

How can I do a database query?

By following the instructions from the mysql 2 npm package? https://www.npmjs.com/package/mysql2

Or is there a way to use wappler queries in a server connect extension?

It’s quite straightforward. You already have knex available to you(in nodejs projects).

Thanks @JonL ! It’s not clicking for me yet though.

I’d like to pass the user’s email to Sentry, like so (from their docs):

app.use(
  Sentry.Handlers.requestHandler({
    serverName: false,
    user: ["email"],
  })
);

I’m a bit at a loss how I can pass the currently logged in user’s email address.
I guess I need to translate this ‘server connect’ way to code:

  1. use Security Identify to get the ID of the user
  2. Do a DB query with that ID for the email

Any pointers?

Same here. I’m trying to use passport.js and authenticate user after the callback.
Any ideas how to do this @JonL?

I’m talking about this part

  function(accessToken, refreshToken, profile, done) {
    // Here you want to lookup or create the user in the database
    /* User.findOrCreate(..., function(err, user) {
      if (err) { return done(err); }
      done(null, user);
    }); */
  }