Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

301
Views
Can i use module.exports from JS file to Vue js file?

Im newbie on JS and i need to handle a many variable from passportFunction to displaying that on my vue app. On my code, let user variable has inside module.exports and i would like export that module on Vue but i got blank page:

My JS file has :

module.exports = function passportFunction (passport) {
  passport.use(
   new GoogleStrategy(
   {
    clientID: process.env.GOOGLE_CLIENT_ID,
    clientSecret: process.env.GOOGLE_CLIENT_SECRET,
  },
 
    try {
      let user = await User.findOne({ googleId: profile.id })

      if (user) {
        done(null, user)
      } else {
        user = await User.create(newUser)
        done(null, user)
      }
    } catch (err) {
      console.error(err)
    }
  }
 )
)

passport.serializeUser((user, done) => {
  done(null, user.id)
})

passport.deserializeUser((id, done) => {
  User.findById(id, (err, user) => done(err, user))
 })
}

My vue file has :

<template>
  <span class="d-none d-md-inline-block"> {{user}} </span>
</template>

<script> 
import passportFunction from '/Users/mac/Desktop/backend/config/file.js'

export default {
methods: {
    user : passportFunction.user,
  },
};
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!