-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db7a03b
commit 3c5f8bb
Showing
5 changed files
with
55 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"net/http" | ||
|
||
"github.com/99designs/gqlgen/example/fileupload" | ||
"github.com/99designs/gqlgen/example/fileupload/model" | ||
"github.com/99designs/gqlgen/graphql" | ||
"github.com/99designs/gqlgen/handler" | ||
) | ||
|
||
func main() { | ||
http.Handle("/", handler.Playground("File Upload Demo", "/query")) | ||
http.Handle("/query", handler.GraphQL(fileupload.NewExecutableSchema(fileupload.Config{Resolvers: &fileupload.Resolver{}}))) | ||
log.Fatal(http.ListenAndServe(":8086", nil)) | ||
resolver := &fileupload.Resolver{ | ||
SingleUploadFunc: func(ctx context.Context, file graphql.Upload) (*model.File, error) { | ||
return &model.File{ | ||
ID: 1, | ||
},nil | ||
}, | ||
} | ||
http.Handle("/query", handler.GraphQL(fileupload.NewExecutableSchema(fileupload.Config{Resolvers: resolver}))) | ||
|
||
log.Print("connect to http://localhost:8087/ for GraphQL playground") | ||
log.Fatal(http.ListenAndServe(":8087", nil)) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Alpha file content |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Bravo file content |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Charlie file content |