Created
September 6, 2019 12:13
-
-
Save codyzu/22eef4da18f09b24dff28ae774071092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getUserFromDatabase(ctx) { | |
const { | |
req: { | |
headers: {Authorization: userCred}, | |
}, | |
} = ctx; | |
const user = await db.getUserByCredential(userCred); | |
return { | |
...ctx, | |
user, | |
}; | |
} | |
async function sendMessageToUser(ctx) { | |
const {user} = ctx; | |
await messaging.sendToUser(user.username, 'hello'); | |
return ctx; | |
} | |
async function replyOk(ctx) { | |
const {user} = ctx; | |
const {res} = ctx; | |
res.status(200).send(`Ok ${user.username}`); | |
return ctx; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment