Skip to content

Commit

Permalink
refactor: refactor startup routes
Browse files Browse the repository at this point in the history
  • Loading branch information
baimamboukar committed Dec 26, 2023
1 parent 0686d0c commit ac5beef
Showing 1 changed file with 11 additions and 34 deletions.
45 changes: 11 additions & 34 deletions src/routes/startups.go
Original file line number Diff line number Diff line change
@@ -1,41 +1,18 @@
package routes

import "github.com/gin-gonic/gin"
import (
"github.com/gin-gonic/gin"

"github.com/baimamboukar/go-gin-docker-k8s/src/controllers"
)

func startupsGroupRouter(baseRouter *gin.RouterGroup) {
startups := baseRouter.Group("/startups")

startups.GET("/all", GetAllStartups)
startups.GET("/:id", GetStartupByID)
startups.POST("/create", CreateStartup)
startups.PATCH("/update", UpdateStartup)
startups.PUT("/update", UpdateStartup)
startups.DELETE("/:id", DeleteStartup)
}

func GetAllStartups(c *gin.Context) {
// Implement logic to get all startups
c.JSON(200, gin.H{"message": "Get all startups"})
}

func GetStartupByID(c *gin.Context) {
// Implement logic to get a startup by ID
startupID := c.Param("id")
c.JSON(200, gin.H{"message": "Get startup by ID", "id": startupID})
}

func CreateStartup(c *gin.Context) {
// Implement logic to create a new startup
c.JSON(200, gin.H{"message": "Create a new startup"})
}

func UpdateStartup(c *gin.Context) {
// Implement logic to update a startup
c.JSON(200, gin.H{"message": "Update a startup"})
}

func DeleteStartup(c *gin.Context) {
// Implement logic to delete a startup by ID
startupID := c.Param("id")
c.JSON(200, gin.H{"message": "Delete startup by ID", "id": startupID})
startups.GET("/all", controllers.GetAllStartups)
startups.GET("/get/:id", controllers.GetStartupByID)
startups.POST("/create", controllers.CreateStartup)
startups.PATCH("/update", controllers.UpdateStartup)
startups.PUT("/update", controllers.UpdateStartup)
startups.DELETE("/delete/:id", controllers.DeleteStartup)
}

2 comments on commit ac5beef

@vercel
Copy link

@vercel vercel bot commented on ac5beef Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ac5beef Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.