Last active
January 9, 2018 15:27
-
-
Save gbielecki/c1d9c65e44bf50495ceaa3702caf4e52 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
import Syncano from 'syncano-server' | |
import crypto from 'crypto' | |
export default (ctx) => { | |
const {data,response} = Syncano(ctx) | |
if (ctx.args.sender && ctx.args.receiver && ctx.args.wishes) { | |
data.wishes.create({ | |
sender: ctx.args.sender, | |
receiver: ctx.args.receiver, | |
wishText: ctx.args.wishes, | |
cryptoId: crypto.randomBytes(2).toString('hex') | |
}) | |
.then(wishObj => { | |
response.json(wishObj.cryptoId) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment