shouheiyamauchi / react-passport-example Goto Github PK
View Code? Open in Web Editor NEWAn example application for authentication using a Node.js back-end and React JS front-end
An example application for authentication using a Node.js back-end and React JS front-end
After login, if reload page Dashboard on enter manually http://localhost:3000/dashboard the page does not work.
Ok, so I got it to work, but I am having a small issue I need the API url to be able to search collections etc.
how do I set that up?
I tried adding the following to api.js with no success
const express = require('express');
//const Pages = require('mongoose').model('Pages');
const router = new express.Router();
router.get('/dashboard', (req, res) => {
res.status(200).json({
message: "You're authorized to see this secret message.",
// user values passed through from auth middleware
user: req.user
});
});
router.get('/pages', (req, res) => {
/* Pages.find({}, function(err, docs) {
if (!err){
console.log(docs);
process.exit();
} else {throw err;}
});
*/
res.status(200).json({
message: "You're authorized to see to edit pages.",
// user values passed through from auth middleware
user: req.user
});
});
module.exports = router;
I was trying to get this to work on a plesk server and it will not start.
Would be good if this would work from npm install and npm start
-- Other issues
Hot reloading is not working for me. I have to wait several seconds for it be bundled and then I have to refresh the page.
In the components
folder, there's a Base.js
component but the code inside it is commented and I did not understand the reason behind this component.
The instructionsudo mongod
(typo?) in the README presumes the installation of an executable. It would be nice to provide minimal guidance to users who are new to mongodb.
This DB call isn't needed:
A valid, short-lived JWT should be enough to access an endpoint - you're getting no benefit if your middleware is doing a DB call every request...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.