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
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("/");
});
});