node.js - angular2 express session can't save -
i'm practising web service node.js express server , angular2 frontend. if run server webpack, runs on localhost:3000 , session saved correctly. development (due build time) case, if run application on localhost:8080 , communicate server (which on port 3000), can't save session. me this?
at first time, couldn't communicate between port 8080 , 3000 added below code inside server part.
let allowcrossdomain = function(req, res, next) { res.header('access-control-allow-origin', "*"); res.header('access-control-allow-methods', 'get,put,post,delete'); res.header('access-control-allow-headers', 'content-type'); next(); }; app.use(allowcrossdomain);
and session setting
app.use(session({ secret: 'sercret', resave: false, saveuninitialized: true }));
thank time !
Comments
Post a Comment