import { createHttpLink } from 'apollo-link-http';
const httpLink = createHttpLink({
uri: BACKEND_URI,
fetch,
credentials: 'same-origin',
});
import { createUploadLink } from 'apollo-upload-client';
const httpLink = createUploadLink({
uri: BACKEND_URI,
fetch,
credentials: 'same-origin', // 'include' 변경 후 검토필요 // Additional fetch() options like `credentials` or `headers`
});
Mutation: {
createImage: async (_, { file, size }) => {
const { filename, mimetype, createReadStream } = await file;
const { keyFilename, projectId, bucketName, fileName, metadata } = uploadPicturesHelper(
filename,
mimetype,
);
graphql 파일전송시 apollo-upload-client
라는 라이브러리를 통해서 데이터를 전송할 수 있다.