2017-11-27 14 views
0

나는 reactjs에서 새로운 shopify 응용 프로그램을 만드는 데이 라이브러리를 사용하고 있습니다. https://github.com/fullstackreact/food-lookup-demo여러 경로가있는 빠른 세션 문제가 정의되지 않았습니다.

하지만 예를 들어 여러 경로로 작동하지의 세션을 사용하려고 할 때 :

req.session.shop = 'yshop'; set in shopify file and when I am trying to get 
console.log(req.session.shop); in another routes file its showing undefined. 

server.js 코드 :

app.set('trust proxy', 1) // trust first proxy 
app.use(session({ 
    secret: "[email protected][email protected]#$D&W", 
    resave: true, 
    saveUninitialized: true, 
    proxy: true, 
    cookie: { secure: true, maxAge: 60000 } 
})); 

그것이 작동하지, 누군가가 나를 도울를?

답변

0

아마 당신은이 같은 세션 이름을 설정해야합니다 :

app.use(session({ 
    secret: "[email protected][email protected]#$D&W", 
    name: 'mySessionName', 
    resave: true, 
    saveUninitialized: true, 
    proxy: true, 
    cookie: { secure: true, maxAge: 60000 } 
})); 

나는 그것이 트릭을 수행합니다 확실하지 않다, 그러나 나는 또한 내 구성에 saveUninitialized:false를 설정하고있다.

희망이 있습니다.

+0

그래 내가이 문제를 해결하도록하겠습니다. –

+0

아니요 작동하지 않습니다. 여전히 console.log에 정의되지 않음을 표시합니다. –

+0

differents 경로를 표시 할 수 있습니까? – Sparw