Last active
September 24, 2019 18:27
-
-
Save sockol/bf74618c1361e35de6e7d56ce11ec05d to your computer and use it in GitHub Desktop.
Unit test file uploads in your Apollo GraphQL Server
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
addFile: async (_, options) => { | |
const { | |
file, | |
input | |
} = options; | |
try { | |
const { stream, filename, mimetype } = await file; | |
const s3File = await someFileStoreService.upload({ stream, filename, mimetype }); | |
return s3File | |
} catch (error) { | |
throw new Error(error); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment