Last active
February 12, 2018 11:59
-
-
Save recidive/0c467689717eaedaa6db81a90512a19b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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