Skip to content

Instantly share code, notes, and snippets.

View yisyang's full-sized avatar

Scott Yang yisyang

  • Alhambra, CA
View GitHub Profile
@yisyang
yisyang / code.coffee
Last active September 7, 2015 11:21
early-termination-in-node-express-waterline-bluebird
# Attempt to create the alias
aliases.create(new_alias)
.then (alias) ->
# The .success method outputs JSON and calls res.end()
res._cc.success(alias)
return
.catch () ->
# Alias must not currently exist
aliases.findOne().where({ src_name: new_alias.src_name })
.then (alias) ->