Skip to content

Commit

Permalink
updated api docs and google links
Browse files Browse the repository at this point in the history
  • Loading branch information
nourkrimesh committed Aug 10, 2023
1 parent 61f1841 commit 39363ea
Show file tree
Hide file tree
Showing 3 changed files with 243 additions and 454 deletions.
3 changes: 1 addition & 2 deletions src/db/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 11,9 @@ const connectToDatabase = async () => {
} else if (config.environment === 'test') {
mongoURI = config.mongo.testDB.url;
}
console.log('1: trying to connect to database with connStr:', mongoURI);

if (mongoURI !== undefined) {
try {
console.log('2: trying to connect to database with connStr:', mongoURI);
await mongoose.connect(mongoURI, {
useNewUrlParser: true,
useUnifiedTopology: true,
Expand Down
15 changes: 8 additions & 7 deletions src/routes/googleAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 11,14 @@ router.route("/google").get(passport.authenticate("google", {

router.get("/google/callback", passport.authenticate("google", { failureRedirect: '/', session: false }), (req: Request, res: Response) => {
// res.send("You have been signed in successfully! You will be redirected to Home");
res.send({
_id: req.user._id,
firstname: req.user.firstname,
lastname: req.user.lastname,
email: req.user.email,
token: generateToken(req.user._id),
});
// res.send({
// _id: req.user._id,
// firstname: req.user.firstname,
// lastname: req.user.lastname,
// email: req.user.email,
// token: generateToken(req.user._id),
// });
res.render('home');
});


Expand Down
Loading

0 comments on commit 39363ea

Please sign in to comment.