Skip to content

Commit

Permalink
Remove all routes
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sumi-k committed Sep 18, 2023
1 parent 1bd6ce7 commit 050232b
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
package main

import (
"blogs"
"contact"
"context"
"contribution"
"db"
"embed"
"jobs"
"leave"
"net/http"
"notification"
"os"
"sitemap"
"utils"

"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
Expand Down Expand Up @@ -47,41 +38,41 @@ func LambdaHandler(ctx context.Context, req events.APIGatewayProxyRequest) (even

func setupRouter() *gin.Engine {

sqlDb := db.NewSql()
// sqlDb := db.NewSql()

router := gin.Default()

router.Use(cors.New(corsConfig()))
router.Use(gzip.Gzip(gzip.DefaultCompression))

utilsRepo := utils.NewEmail()
contactRepo := contact.New(templateFS, utilsRepo)
jobsRepo := jobs.New(sqlDb, templateFS, utilsRepo)
sitemapRepo := sitemap.New(jobsRepo)
leaveRepo := leave.New(templateFS, utilsRepo)
notificationRepo := notification.New(templateFS, utilsRepo)
// utilsRepo := utils.NewEmail()
// contactRepo := contact.New(templateFS, utilsRepo)
// jobsRepo := jobs.New(sqlDb, templateFS, utilsRepo)
// sitemapRepo := sitemap.New(jobsRepo)
// leaveRepo := leave.New(templateFS, utilsRepo)
// notificationRepo := notification.New(templateFS, utilsRepo)

router.POST("/api/send-contact-mail", contactRepo.SendContactMail)
// router.POST("/api/send-contact-mail", contactRepo.SendContactMail)

router.GET("/api/careers", jobsRepo.Careers)
// router.GET("/api/careers", jobsRepo.Careers)

router.GET("/api/careers/:unique_id", jobsRepo.CareerById)
// router.GET("/api/careers/:unique_id", jobsRepo.CareerById)

router.POST("/api/send-jobs-applications", jobsRepo.SaveApplicationsData)
// router.POST("/api/send-jobs-applications", jobsRepo.SaveApplicationsData)

router.GET("/api/sitemap", sitemapRepo.GenerateSitemap)
// router.GET("/api/sitemap", sitemapRepo.GenerateSitemap)

router.GET("/api/blogs", blogs.Get)
// router.GET("/api/blogs", blogs.Get)

router.GET("/api/github/stars", contribution.GetStargazers)
// router.GET("/api/github/stars", contribution.GetStargazers)

router.POST("/api/leave/new", leaveRepo.SendLeaveRequest)
// router.POST("/api/leave/new", leaveRepo.SendLeaveRequest)

router.POST("/api/leave/update", leaveRepo.SendUpdateLeaveMail)
// router.POST("/api/leave/update", leaveRepo.SendUpdateLeaveMail)

router.POST("/api/invitation", notificationRepo.SendInvitationMail)
// router.POST("/api/invitation", notificationRepo.SendInvitationMail)

router.POST("/api/acceptence", notificationRepo.SendAcceptenceMail)
// router.POST("/api/acceptence", notificationRepo.SendAcceptenceMail)

router.GET("/api/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
Expand All @@ -99,6 +90,7 @@ func corsConfig() cors.Config {
}

func main() {
log.Info("router: ", router)
router = setupRouter()
log.Info("router: ", router)
ginLambda = ginadapter.New(router)
Expand Down

0 comments on commit 050232b

Please sign in to comment.