Skip to content

Instantly share code, notes, and snippets.

View gnet.go
// Copyright 2019 Andy Pan. All rights reserved.
// Copyright 2017 Joshua J Baker. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package main
import (
"flag"
"fmt"
@birowo
birowo / cobaJWT.go
Last active Jan 25, 2019
golang: latihan json-web-token(JWT) dengan pakai library: https://github.com/dgrijalva/jwt-go
View cobaJWT.go
package main
import (
"errors"
"fmt"
"time"
jwt "github.com/dgrijalva/jwt-go"
)
View cobaCaptcha.go
package main
import (
"net/http"
"github.com/julienschmidt/httprouter"
"github.com/mojocn/base64Captcha"
)
func main() {
@birowo
birowo / menangkap_post_data_json_pakai_gin.go
Last active Dec 13, 2018
golang: contoh skrip untuk menangkap post data json pakai gin
View menangkap_post_data_json_pakai_gin.go
package main
import (
"fmt"
"github.com/gin-gonic/gin"
)
type Struct struct {
/* setiap pakai json, huruf pertama dari field struct harus kapital,
View routerLikeGraphQL.go
package main
import (
"encoding/json"
"math"
"net/http"
"net/url"
"strconv"
"strings"
@birowo
birowo / routerLikeGraphQL.go
Last active Nov 12, 2018
GOLANG. coba aplikasi yang menggunakan http router dibuat seperti(meski tidak secanggih) graphql . di sini saya buat untuk method GET request saja.
View routerLikeGraphQL.go
package main
import (
"encoding/json"
"math"
"net/http"
"net/url"
"strconv"
"strings"
@birowo
birowo / cobaGraphQL.go
Last active Oct 31, 2018
contoh implementasi custom scalar di https://github.com/graph-gophers/graphql-go . menambahkan/modifikasi pada latihan graphql terdahulu: https://gist.github.com/birowo/01be2785bdd3b8a875ac1803be79888f
View cobaGraphQL.go
package main
import (
"encoding/json"
"net/http"
"sync"
"github.com/graph-gophers/graphql-go"
)
View cobaGraphQL.go
package main
import (
"encoding/json"
"net/http"
"sync"
"github.com/graph-gophers/graphql-go"
)
@birowo
birowo / graphql-go-mongodb-example.go
Created Oct 24, 2018 — forked from trunet/graphql-go-mongodb-example.go
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
View graphql-go-mongodb-example.go
// Embedded in this article https://medium.com/p/c98e491015b6
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"