Search posts, tags, users, and pages
Build a complete Node.js app with Google OAuth 2.0 authentication system using passport.js
Samip Poudel
@SamipPoudel · Kathmandu,Nepal
Full-stack Developer & Designer
Markdown supported · ⌘↵ to post
I think to connect to mongoose we might need to connect this way.
mongoose.connect(MONGO_URI).then(() => { console.log("connected to mongodb"); }).catch((e) => { console.log("could not connect to mongodb", e); });
We would als need to install @types/cookie-session
@types/cookie-session
And I think the logout function should be implemented this way
router.get("/logout", (req: Request, res: Response) => { req.logout(function(err) { if (err) { console.error('error when logging out', err); } res.redirect("/"); }); });
I think to connect to mongoose we might need to connect this way.
mongoose.connect(MONGO_URI).then(() => { console.log("connected to mongodb"); }).catch((e) => { console.log("could not connect to mongodb", e); });We would als need to install
@types/cookie-sessionAnd I think the logout function should be implemented this way
router.get("/logout", (req: Request, res: Response) => { req.logout(function(err) { if (err) { console.error('error when logging out', err); } res.redirect("/"); }); });