Skip to content

Have anyone got the plan for uploading file? #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jianjungki opened this issue Jun 9, 2018 · 1 comment
Open

Have anyone got the plan for uploading file? #330

jianjungki opened this issue Jun 9, 2018 · 1 comment

Comments

@jianjungki
Copy link

jianjungki commented Jun 9, 2018

i can't find the method to upload file, i have saw the apollo upload examples, and i found the graphql-js is so different from graphql-go.

var Upload = graphql.NewScalar(graphql.ScalarConfig{
	Name: "Upload",
	Description: "The `Upload` scalar type represents a file upload promise that resolves " +
		"an object containing `stream`, `filename`, `mimetype` and `encoding`.",
	Serialize:  coerceFile,
	ParseValue: coerceFile,
	ParseLiteral: func(valueAST ast.Value) interface{} {
		fmt.Println("wrong func")
		return nil
	},
})

func coerceFile(value interface{}) interface{} {
	return value
}

i write the scalar for uploading, but i found it doesn't work well

@glaslos
Copy link

glaslos commented Aug 2, 2018

Probably not going to help you, but here is some already ongoing discussion on the topic: #141
You might want to consider a middleware for your graphql handler that takes the binary data, stores it and crafts a specific graphql request with the storage location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants