Created
August 10, 2019 15:55
-
-
Save github-francisco-pereira/10cceaaa78cb1e661438cd45dc3dd039 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
| const multer = require('multer'); | |
| module.exports = (app) => { | |
| const storage = multer.memoryStorage(); | |
| app.use('/', multer({ storage }).single('file')); | |
| }; | |
| const { | |
| GraphQLString, | |
| GraphQLObjectType, | |
| } = require('graphql'); | |
| const uploadImageResolver = require('app/resolvers/upload_image'); | |
| const ReturnUpdateImage = new GraphQLObjectType({ | |
| name: 'ReturnUpdateImage', | |
| description: 'Return of mutation', | |
| fields: { | |
| urlImage: { | |
| type: GraphQLString, | |
| description: 'Public url image', | |
| resolve({ data }) { | |
| return data; | |
| }, | |
| }, | |
| }, | |
| }); | |
| module.exports = { | |
| type: ReturnUpdateImage, | |
| description: 'Save image', | |
| resolve(root, args, context) { | |
| return uploadImageResolver(args, context); | |
| }, | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment