This is the code that runs https://bandolier.learnjsthehardway.com/ for you to review. It uses the https://git.learnjsthehardway.com/learn-javascript-the-hard-way/bandolier-template to create the documentation for the project.
https://bandolier.learnjsthehardway.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
export const get = (req, res) => {
|
|
// NOTE: we could also set authenticated in models.User.auth but this is more of a
|
|
// UI level variable than an authentication variable. If the code gets to this
|
|
// point then the get.authenticated passed and the user has to be authenticated.
|
|
const reply = {
|
|
id: req.user.id,
|
|
initials: req.user.initials,
|
|
full_name: req.user.full_name,
|
|
admin: req.user.admin,
|
|
email: req.user.email,
|
|
discord_sent: req.user.discord_sent,
|
|
unsubscribe: req.user.unsubscribe,
|
|
authenticated: true
|
|
}
|
|
res.status(200).json(reply);
|
|
}
|
|
|
|
get.authenticated = true;
|
|
|
|
export const post = (req, res) => {
|
|
const reply = {
|
|
id: req.user.id,
|
|
initials: req.user.initials,
|
|
full_name: req.user.full_name,
|
|
admin: req.user.admin,
|
|
email: req.user.email,
|
|
unsubscribe: req.user.unsubscribe,
|
|
discord_sent: req.user.discord_sent,
|
|
authenticated: true
|
|
}
|
|
res.status(200).json(reply);
|
|
}
|
|
|
|
// this flags it as a login endpoint expecting a username/password
|
|
post.login = true;
|
|
|