This file contains hidden or 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
package registry | |
import ( | |
"github.com/jinzhu/gorm" | |
"github.com/manakuro/golang-clean-architecture/interface/controller" | |
) | |
type registry struct { | |
db *gorm.DB | |
} |
This file contains hidden or 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
package registry | |
import ( | |
"golang-clean-architecture/interface/controller" | |
ip "golang-clean-architecture/interface/presenter" | |
ir "golang-clean-architecture/interface/repository" | |
"golang-clean-architecture/usecase/interactor" | |
) | |
func (r *registry) NewUserController() controller.UserController { |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
_ "github.com/jinzhu/gorm/dialects/mysql" | |
"github.com/labstack/echo" | |
"github.com/manakuro/golang-clean-architecture/config" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello Go App!") |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello Go App! This is my first deploy!") |
This file contains hidden or 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
version: 2.1 | |
orbs: | |
gcp-cli: circleci/[email protected] | |
executors: | |
default: | |
docker: | |
- image: google/cloud-sdk | |
working_directory: go/src/github.com/manakuro/golang-deploy-gcp |
This file contains hidden or 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
type Token struct { | |
Token string `json:"token"` | |
} | |
func SignIn() echo.HandlerFunc { | |
return func(c echo.Context) error { | |
username := c.FormValue("username") | |
password := c.FormValue("password") | |
if username == "you" && password == "passed" { |
This file contains hidden or 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
func GenerateToken() (string, error) { | |
keyData, err := ioutil.ReadFile("./id_rsa") | |
if err != nil { | |
return "", err | |
} | |
key, err := jwt.ParseRSAPrivateKeyFromPEM(keyData) | |
if err != nil { |
This file contains hidden or 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
e.POST("/signIn", handler.SignIn()) | |
// Restricted from here | |
r := e.Group("graphql") | |
key, err := auth.GetRSAPublicKey() | |
logFatal(err) | |
r.Use(middleware.JWTWithConfig(middleware.JWTConfig{ | |
SigningKey: key, |
This file contains hidden or 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
e.POST("/signIn", handler.SignIn()) |