Utilizing Express and Passport, I serve all my files statically in the following manner.
// static bundle from webpack
app.use('/', express.static(__dirname + '/../client-react/dist'));
As a result, when I'm on the client side, I have no way of determining if I am logged in.
Passport is functioning correctly, allowing me to retrieve profile data on the server.
An AJAX request is implemented as follows:
$.ajax({
url: "/api/items",
success: (results) => {
console.log(results);
this.props.dispatch({type: 'updateBookmarks', bookmarks: results});
}
});
}
The server responds with:
router.route('/items').get((req, res) => {
console.log(req.user);
DB.selectAllDomains().then((results) => {
res.json(results);
});
});