Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from Go Gin to Go Fiber #29

Closed
rabilrbl opened this issue Sep 5, 2023 · 0 comments · Fixed by #30
Closed

Migration from Go Gin to Go Fiber #29

rabilrbl opened this issue Sep 5, 2023 · 0 comments · Fixed by #30
Assignees
Labels
enhancement New feature or request

Comments

@rabilrbl
Copy link
Owner

rabilrbl commented Sep 5, 2023

As part of our ongoing efforts to improve the performance and scalability of our Go web application, we have decided to migrate from Go Gin to Go Fiber. Go Fiber is a lightweight and fast web framework that is compatible with the Go standard library, offers similar features to Go Gin, and provides additional optimizations.

Proposed Solution

To complete this migration, we need to update our codebase and replace Go Gin-specific functionality with equivalent or similar features in Go Fiber. This will involve making changes to our routing, middleware, request handling, and response handling code.

Tasks

  • Research the differences between Go Gin and Go Fiber and identify the corresponding changes required in our codebase.
  • Update the routing logic to use Go Fiber's routing syntax and ensure that all existing routes are correctly migrated.
  • Review the middleware stack and update it to use Go Fiber's middleware functionality, ensuring that all middleware functions are properly integrated.
  • Modify the request and response handling code to reflect the changes in the Go Fiber API.
  • Update any dependencies or third-party libraries that rely on Go Gin-specific functionality to ensure compatibility with Go Fiber.

Additional Information

  • Our codebase is written in Go and is currently using Go Gin version v1.9.1
  • Go Fiber version v2
Example Code Snippet:
package main

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

func main() {
	router := gin.Default()
	router.GET("/hello", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "Hello, World!",
		})
	})
	router.Run(":8080")
}
Example Code Snippet (Updated with Go Fiber):
package main

import (
	"github.com/gofiber/fiber/v2"
	"log"
)

func main() {
	app := fiber.New()
	app.Get("/hello", func(c *fiber.Ctx) error {
		return c.JSON(fiber.Map{
			"message": "Hello, World!",
		})
	})
	log.Fatal(app.Listen(":8080"))
}
@rabilrbl rabilrbl added the enhancement New feature or request label Sep 5, 2023
@rabilrbl rabilrbl self-assigned this Sep 5, 2023
@rabilrbl rabilrbl changed the title breaking: Migration from Go Gin to Go Fiber Migration from Go Gin to Go Fiber Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant