Skip to content

Conversation

@ericamechler
Copy link

@ericamechler ericamechler commented May 24, 2024

Netlify link

Frontend
Backend

Collaborators

[FridaMari, JohannaBN]

ericamechler and others added 25 commits May 21, 2024 14:12
fixed some things with localstorage, can now refresh without being lo…
fixed so that after a user registers, it comes to the signin-page aut…
Copy link
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done creating this authentication app! It works well 🚀

Comment on lines +40 to +59
const authenticateUser = async (req, res, next) => {
try {
const user = await User.findOne({
accessToken: req.header("Authorization"),
});
if (user) {
req.user = user;
next();
} else {
res.status(401).json({
message: "Authentication missing or invalid.",
loggedOut: true,
});
}
} catch (err) {
res
.status(500)
.json({ message: "Internal server error", error: err.message });
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res.json(endpoints);
});

app.post("/register", async (req, res) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good! Just remember to try to name endpoints after what they return or in this case create. For example: /users

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gold star for adding a loader! Render is kind of sleepy ⌛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants