Skip to content

Instantly share code, notes, and snippets.

Hafiz Ismail sogko

Block or report user

Report or block sogko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sogko
sogko / AppHomeRoute.js
Last active Oct 14, 2015
hello-world-relay-part-1 - RelayJS App
View AppHomeRoute.js
import Relay from 'react-relay';
// Your Relay routes
// Define a root GraphQL query into which your
// containers' query fragments will be composed.
export default class extends Relay.Route {
static queries = {
latestPost: () => Relay.QL`
query {
latestPost
@sogko
sogko / file.go
Created Oct 14, 2015
hello-world-relay-part-1 - Update golang server
View file.go
import (
...
"github.com/sogko/golang-relay-starter-kit/data"
)
...
@sogko
sogko / schema.go
Last active Nov 11, 2016
hello-world-relay-part-2 - Schema definition (golang)
View schema.go
package data
import (
"github.com/graphql-go/graphql"
"github.com/graphql-go/relay"
)
var postType *graphql.Object
var queryType *graphql.Object
var Schema graphql.Schema
@sogko
sogko / database.go
Created Oct 14, 2015
hello-world-relay-part-1 - In-memory database
View database.go
package data
// Data model structs
type Post struct {
Id string `json:"id"`
Text string `json:"text"`
}
// Mock data
var latestPost = &Post{
@sogko
sogko / schema.graphql
Created Oct 14, 2015
hello-world-relay-part-1 - Schema definition (Shorthand notation)
View schema.graphql
//
// In GraphQL's type system shorthand notation.
// (See: http://graphql.org/docs/typesystem)
//
type Post {
id: ID!
text: String
}
type Query {
latestPost: Post
@sogko
sogko / curl.sh
Last active Oct 12, 2015
hello-world-graphql-part-1 - Curl command
View curl.sh
curl -XPOST http://localhost:8080/graphql \
-H 'Content-Type: application/graphql' \
-d 'query Root{ latestPost }'
@sogko
sogko / response.json
Created Oct 7, 2015
hello-world-graphql-part-1 - Expected response
View response.json
{
"data": {
"latestPost": "Hello World!"
}
}
@sogko
sogko / main.go
Last active Aug 3, 2016
hello-world-graphql-part-1 - Server
View main.go
package main
import (
"net/http"
"github.com/graphql-go/graphql"
"github.com/graphql-go/graphql-go-handler"
)
var queryType = graphql.NewObject(graphql.ObjectConfig{
// ...
@sogko
sogko / main.go
Last active Aug 3, 2016
hello-world-graphql-part-1 - Schema definition (golang)
View main.go
package main
import (
"github.com/graphql-go/graphql"
)
var queryType = graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.Fields{
"latestPost": &graphql.Field{
@sogko
sogko / schema.graphql
Last active Oct 7, 2015
hello-world-graphql-part-1 - Schema definition (Shorthand notation)
View schema.graphql
//
// In GraphQL's type system shorthand notation.
// (See: http://graphql.org/docs/typesystem)
//
type Query {
latestPost: String
}
You can’t perform that action at this time.