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 / 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 / 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 / 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.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 / 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 / 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 / App.js
Last active Oct 14, 2015
hello-world-relay-part-1 - RelayJS App
View App.js
import React from 'react';
import Relay from 'react-relay';
// Your React component
class App extends React.Component {
render() {
return (
<div>
<h1>{this.props.latestPost.text}</h1>
</div>
@sogko
sogko / test.js
Created Nov 2, 2015
graphql-go #35
View test.js
import {
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
GraphQLNonNull,
GraphQLList,
GraphQLBoolean,
GraphQLInt,
GraphQLFloat,
GraphQLEnumType,
@sogko
sogko / main.go
Last active Jan 20, 2017
[graphql-go] Mutation example
View main.go
package main
import (
"github.com/graphql-go/graphql"
"github.com/kr/pretty"
)
type Todo struct {
ID string `json:"id"`
Text string `json:"text"`
@sogko
sogko / main.go
Last active Jan 13, 2020
[graphql-go] Mutation example with `graphql-go/handler`
View main.go
package main
import (
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
"net/http"
)
type Todo struct {
ID string `json:"id"`
You can’t perform that action at this time.