Skip to content

Instantly share code, notes, and snippets.

@recidive
Last active February 12, 2018 11:59
Show Gist options
  • Save recidive/0c467689717eaedaa6db81a90512a19b to your computer and use it in GitHub Desktop.
Save recidive/0c467689717eaedaa6db81a90512a19b to your computer and use it in GitHub Desktop.
import compose from 'ramda'
import { reviews } from './schema'
import { normalize, denormalize } from '../lib/normalizer'
import { serialize } from '../lib/serializer'
import { validate } from '../lib/validator'
import { load, save } from '../lib/defaultOperations'
import { respond } from '../lib/http'
const get = async (cxt, id) => load(reviews, id)
const post = async cxt => compose(
respond,
serialize,
normalize(reviews),
save('reviews'),
validate(reviews),
denormalize(reviews),
)(ctx)
export {
get,
post,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment