DEV Community

Bruno Ciccarino Ξ» for GopherLight

Posted on

πŸš€ GopherLight v0.2

GopherLight v0.2 Release Notes

πŸš€ GopherLight v0.2 - Enhanced Routing and Middleware Support!

We are excited to announce the second version of GopherLight, bringing more flexibility and features to our lightweight Go framework. With this update, you’ll experience a more powerful routing system and the addition of convenient middleware to streamline your development process.

🎯 Additions

  • Support for Multiple HTTP Methods: GopherLight now allows routing for various HTTP methods such as GET, POST, PUT, DELETE, and more. You can define routes for each specific method, increasing flexibility in handling requests.
app.Route("POST", "/submit", func(r *req.Request, w *req.Response) {
    w.Send("Data received!")
})
Enter fullscreen mode Exit fullscreen mode
  • Logging Middleware: Automatically log the start and completion time of each request, making it easier to debug and monitor the behavior of your app.

  • Timeout Middleware: Prevent long-running requests from blocking your application with the newly introduced timeout middleware. You can set time limits for your request handling.

app.Use(middleware.LoggingMiddleware)
app.Use(middleware.TimeoutMiddleware(2 * time.Second))
Enter fullscreen mode Exit fullscreen mode

πŸ› οΈ Improvements

  • HTTP Method Validation: We've implemented stricter validation for HTTP methods. Now, your routes will only respond to the defined methods, ensuring security and better management of requests.

    πŸ”„ Changes

  • Route Function Refactoring: The route function has been restructured to handle multiple HTTP methods efficiently, improving performance and code clarity.

  • Documentation Update: The documentation has been updated to reflect all the new features, including detailed examples of how to utilize multiple HTTP methods and middleware in your application.

    πŸš€ What’s Next?

  • Enhanced error handling and better integration with third-party services.
    Middleware for authentication and CSRF protection.

  • πŸ“ Contributions GopherLight continues to grow with your support! We welcome contributions, suggestions, and improvements from the community. Feel free to explore, submit issues, or open PRs to make the framework even better.

Top comments (0)