Skip to content

Instantly share code, notes, and snippets.

@BNPrashanth
Created September 13, 2019 08:20
Show Gist options
  • Save BNPrashanth/9ae6d2a34bf3e0697d5bded50e592620 to your computer and use it in GitHub Desktop.
Save BNPrashanth/9ae6d2a34bf3e0697d5bded50e592620 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"net/http"
"github.com/gs-open-provider/poc-go-oauth2/internal/configs"
"github.com/gs-open-provider/poc-go-oauth2/internal/logger"
"github.com/gs-open-provider/poc-go-oauth2/internal/services"
"github.com/spf13/viper"
)
func main() {
// Initialize Viper across the application
configs.InitializeViper()
// Initialize Logger across the application
logger.InitializeZapCustomLogger()
// Initialize Oauth2 Services
services.InitializeOAuthGoogle()
// Routes for the application
http.HandleFunc("/", services.HandleMain)
http.HandleFunc("/login-gl", services.HandleGoogleLogin)
http.HandleFunc("/callback-gl", services.CallBackFromGoogle)
logger.Log.Info("Started running on http://localhost:" + viper.GetString("port"))
log.Fatal(http.ListenAndServe(":"+viper.GetString("port"), nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment