I am completely new to vuejs
I am working on a MEVN app. I setup a vuejs project with vue-cli , which runs on localhost:8080
, and an express server which runs on localhost:3000
.
to send all the requests to my express server, I added proxy in vue's config/index.js which works perfectly.
Now i added passport google oauth in my app.
in server.js file i added
app.get('/auth/google',
passport.authenticate('google', {session : false, scope: ['openid email profile'],accessType: 'offline',prompt: 'consent'}))
and its callback route also
and in my vuejs code i added
<a href="/auth/google">Login with Google</a>
on clicking Login with Google my app works perfectly in development mode but in PRODUCTION mode when i click Login instead of going to google consent screen for login it goes to <app-url>/auth/google
with a blank page
please help me with this..
NOTE : for production mode i did npm run build and then served the static file in server.js file (express) , and also used connect-history-api-fallback
UPDATE :
well connect-history-api-fallback
was the problem but removing it results in broken vuejs routes as m using them in history mode
now what to do ?
Well just re-arranging my server.js did the trick
moved app.use(history()) below app.get('auth/google') and it worked