Skip to content

Instantly share code, notes, and snippets.

@gbielecki
Last active January 9, 2018 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbielecki/c1d9c65e44bf50495ceaa3702caf4e52 to your computer and use it in GitHub Desktop.
Save gbielecki/c1d9c65e44bf50495ceaa3702caf4e52 to your computer and use it in GitHub Desktop.
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