Skip to content

Instantly share code, notes, and snippets.

@hnry
Last active August 15, 2016 23:36
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 hnry/a79d7fa313de7d14657e0bf9de4b6e01 to your computer and use it in GitHub Desktop.
Save hnry/a79d7fa313de7d14657e0bf9de4b6e01 to your computer and use it in GitHub Desktop.
const get_user = (name) => {
return users.findOne({ name: name })
}
const get_likes = (name) => {
// get user info
return get_user(name).then((user) => {
return likes.findAll({ id: user.id })
})
}
// can make them routes
const app = route.define([
route.get("/api/user/:name", ["name"], get_user),
route.get("/api/likes/:name", ["name"], get_likes)
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment