Skip to content

Commit

Permalink
routes started
Browse files Browse the repository at this point in the history
  • Loading branch information
kasyap1234 committed Apr 6, 2024
1 parent 83a3349 commit f0e3f23
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 106 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
APP_NAME=MyApp
API_DOMAIN=myapi.example.com
WEBSITE_DOMAIN=mywebsite.example.com
DATABASE_URL=your_database_connection_url
export GIN_MODE=release
45 changes: 45 additions & 0 deletions auth/auth_handlers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package auth

import (
"net/http"
"os"

"github.com/gin-gonic/gin"
"github.com/supertokens/supertokens-golang/recipe/emailpassword"
"github.com/supertokens/supertokens-golang/recipe/session"
"github.com/supertokens/supertokens-golang/supertokens"
)

// InitSuperTokens initializes SuperTokens with the provided configuration
func InitSuperTokens(router *gin.Engine, apiBasePath, websiteBasePath string) error {
// Initialize SuperTokens
err := supertokens.Init(supertokens.TypeInput{
Supertokens: &supertokens.ConnectionInfo{
ConnectionURI: "https://try.supertokens.com", // Replace with your SuperTokens connection URI
},
AppInfo: supertokens.AppInfo{
AppName: os.Getenv("APP_NAME"),
APIDomain: os.Getenv("API_DOMAIN"),
WebsiteDomain: os.Getenv("WEBSITE_DOMAIN"),
APIBasePath: &apiBasePath, // Use pointer to string
WebsiteBasePath: &websiteBasePath, // Use pointer to string
},
RecipeList: []supertokens.Recipe{
emailpassword.Init(nil),
session.Init(nil),
},
})
if err != nil {
return err
}

// Attach SuperTokens middleware to the router
router.Use(func(c *gin.Context) {
supertokens.Middleware(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// Your middleware logic here
})).ServeHTTP(c.Writer, c.Request)
c.Abort()
})

return nil
}
43 changes: 0 additions & 43 deletions auth/handlers/auth_handlers.go

This file was deleted.

7 changes: 2 additions & 5 deletions collections/company_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package collections

import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongogb.org/mongo-driver/mongo"
)



type CompanyCollection struct {
collection *mongo.Collection
}
Expand All @@ -15,7 +16,3 @@ func CompanyCollectionInit(database *mongo.Database) *CompanyCollection {
}

}
func (CompanyCollection *CompanyCollection) GetCompanyNames(model.company) {
return

}
Binary file modified eduhub_backend_golang
Binary file not shown.
45 changes: 43 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,56 @@ module github.com/kasyap1234/eduhub_backend_golang
go 1.22.1

require (
github.com/gin-contrib/cors v1.7.1
github.com/gin-gonic/gin v1.9.1
github.com/joho/godotenv v1.5.1
github.com/supertokens/supertokens-golang v0.17.5
go.mongodb.org/mongo-driver v1.14.0
)

require (
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/derekstavis/go-qs v0.0.0-20180720192143-9eef69e6c4e7 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
gopkg.in/h2non/gock.v1 v1.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit f0e3f23

Please sign in to comment.