Releases: hokamsingh/lessgo
LessGo v1.0.4
Release Notes for LessGo v1.0.4 🚀
Overview
Version v1.0.4 introduces enhanced HTTP server configuration capabilities to the LessGo framework. This release adds support for more granular HTTP server settings, allowing developers to tailor their server configurations according to development and production needs. 🔧✨
New Features
-
HTTP Server Configuration:
- ReadTimeout: Set the maximum duration for reading requests. Default is 5 seconds. ⏳
- WriteTimeout: Set the maximum duration for writing responses. Default is 5 seconds. ✍️
- IdleTimeout: Set the maximum duration to keep connections idle before closing. Default is 120 seconds. ⌛
- MaxHeaderSize: Configure the maximum size of request headers. Default is 1 MB. 📏
-
TLS Support:
- TLSCertFile: Path to the TLS certificate file. If provided, enables HTTPS. 🔒
- TLSKeyFile: Path to the TLS key file. If provided, enables HTTPS. 🔑
- MinVersion: Configured to TLS 1.2 for secure communication. 🔐
-
Security Configurations:
- EnableHSTS: Support for HTTP Strict Transport Security (HSTS). Enabled by default. 🛡️
- ContentSecurityPolicy: Default Content Security Policy (CSP) is set to
default-src 'self'
. 🛡️
-
Session Management:
- Session Store: Configurable session store type. Default is "memory". 🗄️
- Session Timeout: Configurable session timeout in seconds. Default is 3600 seconds (1 hour). ⏲️
Configuration Example
To leverage the new HTTP configuration features, you can initialize the HttpConfig
with custom settings like so:
httpCfg := LessGo.NewHttpConfig(
LessGo.WithReadTimeout(10),
LessGo.WithWriteTimeout(10),
LessGo.WithIdleTimeout(60),
LessGo.WithMaxHeaderSize(2<<20), // 2 MB
LessGo.WithTLSCertFile("path/to/server.cert"),
LessGo.WithTLSKeyFile("path/to/server.key"),
LessGo.WithHSTS(true),
LessGo.WithContentSecurityPolicy("default-src 'self'; script-src 'self'"),
LessGo.WithSessionStore("redis"),
LessGo.WithSessionTimeout(7200), // 2 hours
)
if err := App.Listen(addr, httpCfg); err != nil {
log.Fatalf("Server failed: %v", err)
}
In this release, the HTTP server configuration now provides greater flexibility and control over server behavior, making it easier to adapt to various environments and security requirements. 🌟
Happy coding! 🚀
Contributors:
- Hokam Singh (@hokamsingh) 🙌
- The LessGo Community 🌍
Release Date: August 2024 📅
v1.0.2
🚀 LessGo v1.1.1 - The High-Performance Minimal Go Web Framework
Welcome to LessGo ⚡—a high-performance, minimal Go web framework crafted for building scalable, maintainable, and modern applications. LessGo empowers developers with advanced features like dynamic configuration management, inbuilt error handling, robust data validation, and Dependency Injection (DI).
Inspired by the modular architecture of frameworks like NestJs, LessGo offers a flexible structure that allows you to build your applications your way. Whether you prefer a strict controller-service-module architecture or a more fluid design, LessGo has you covered. With built-in support for CORS, CSRF, XSS protection, logging, error handling, rate limiting, caching, and job scheduling, LessGo makes it easier to develop secure, efficient, and performant web applications.
✨ Key Features:
-
🔄 Concurrency & Task Management
LessGo includes a powerful task manager that allows you to run tasks in parallel or sequence, giving you full control over task management and program flow. We are committed to enhancing its robustness and extensibility. -
⚙️ Dynamic Configuration Management
With built-in support for multiple environments (development, production, testing), LessGo simplifies configuration management. It provides a user-friendly API for working with environment variables, offering validation and easy access to typed values like numbers and booleans. -
🔧 LessGo Context
The LessGo Context is a powerful abstraction over the request and response objects. It simplifies API development by providing methods for handling headers, cookies, query parameters, JSON parsing, and more. Error management, HTTP redirection, and file attachments are made effortless. -
🧩 Flexible Dependency Injection (DI)
LessGo offers basic DI functionality that we're continuously improving. You can choose whether to bind your entire application into a single container or work with a more traditional approach, giving you flexibility in how you manage dependencies. -
🚀 App Initialization
The App is the core of LessGo, initializing various configurations and middleware. It exposes the main server with a simpleListen
method to start your application. -
⏰ Job Scheduling
LessGo supports job scheduling, leveraging the powerful Cron package to handle recurring tasks seamlessly. -
🔒 Comprehensive Middleware
LessGo comes with essential built-in middleware, including CORS, JSON parser, cookie parser, CSRF and XSS protection, caching, file uploads, and rate limiting (both in-memory and Redis-backed). -
🌐 Powerful Router
The built-in router handles different HTTP methods with custom handlers, supporting method chaining, sub-routers, and custom middleware. -
📦 Controller Interface
Controllers in LessGo allow you to create dedicated routers for specific endpoints, integrating seamlessly with the service layer for efficient request handling. -
🔍 Service Layer
The Service interface in LessGo is designed for encapsulating business logic. It easily binds to databases and other dependencies, streamlining the development process. -
🔗 Modular Design
Modules in LessGo bring together controllers and services, managing routes and handlers in a cohesive manner. -
💬 WebSocket Support (Upcoming)
We are actively working on integrating WebSocket support to make real-time communication in your applications even easier.
📦 Installation & Upgrade
To get started with the latest version of LessGo, update your dependencies using:
go get github.com/hokamsingh/lessgo@latest
🌟 Get Started Quickly with LessGo CLI
We're also introducing the LessGo CLI, a command-line tool to help you scaffold and manage your LessGo projects with ease! With the CLI, you can:
- Create a New Project: Quickly set up a new LessGo project using
lessgo-cli new myapp
. - Check Version: Keep track of the CLI version with
lessgo-cli --version
. - Cross-Platform Support: Works seamlessly on both Windows and Unix-based systems.
Install the LessGo CLI with:
go install github.com/hokamsingh/lessgo-cli@latest
Make sure to try out the CLI to streamline your project setup and start building with LessGo in no time!
🙌 Acknowledgments
We would like to thank our contributors and community for their support and feedback. Your contributions have been invaluable in shaping the LessGo framework.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions, issues, or feedback, please visit our GitHub repository or join our community discussions.
Happy coding! 🎉
v1.0.0
⚙️ Release Notes - LessGo v1.0.0
Overview
We are excited to announce the release of LessGo v1.0.0! 🎉 This major update introduces powerful new features focused on enhancing the security, performance, and flexibility of the lessgo
framework. With the addition of CSRF and XSS protection middlewares, Redis-based caching, and support for Server-Sent Events (SSE), this release is packed with improvements to help you build more robust Go applications. 🚀
New Features & Fixes
-
🛡️ CSRF Protection Middleware:
LessGo.WithCsrf()
: Built-in Cross-Site Request Forgery (CSRF) protection to secure your applications from unauthorized actions performed on behalf of authenticated users.
-
🔒 XSS Protection Middleware:
LessGo.WithXss()
: Integrated Cross-Site Scripting (XSS) protection to prevent attackers from injecting malicious scripts into your application's content.
-
⚡ Caching Middleware:
LessGo.WithCaching("localhost:6379", 5*time.Minute)
: Redis-based caching middleware to improve performance by caching frequently accessed data. Configurable cache expiration provides flexibility in managing caching strategies.
-
📡 Server-Sent Events (SSE) Support:
- Native support for Server-Sent Events (SSE), enabling real-time communication from the server to the client with minimal setup.
-
🖥️ Template Rendering:
- Enhanced template rendering capabilities, allowing templates to be dynamically loaded from a specified directory, reducing the need to manually list each template file.
-
🛠️ Response Handling Improvements:
- Improved response handling to ensure that multiple responses are not sent from the same context, preventing unexpected behavior and potential crashes.
-
⚙️ General Fixes and Optimizations:
- Various performance enhancements and optimizations to ensure the framework runs smoothly and efficiently.
Breaking Changes
- ❌ No breaking changes in this release. All updates are backward-compatible with previous versions.
Installation and Upgrade
To upgrade to version v1.0.0, use the following command:
go get github.com/hokamsingh/[email protected]
Documentation
For detailed documentation on the new features and improvements, please refer to the updated LessGo Documentation.
Thank you for choosing LessGo! 🙌 Your feedback and contributions are invaluable. For more details, refer to our documentation or contact our support team.
Happy coding! 💻✨
Contributors:
- Hokam Singh (@hokamsingh)
- The LessGo Community
Release Date: August 2024
Full Changelog: v0.3.0...v1.0.0
v0.3.0
Release Notes - LessGo v0.3.0
Overview
We are thrilled to announce the release of LessGo v0.3.0! This release brings a host of new features and improvements to the lessgo
framework, including a powerful concurrency API, a cron scheduler, and significant enhancements to modules and controllers. These updates are designed to enhance the framework's capabilities and provide a more robust foundation for your Go applications.
New Features & Fixes
-
Concurrency API:
- Introduced a comprehensive concurrency API that allows for the execution of multiple tasks either in parallel or sequentially.
- Provides full control over Go's goroutines and channels with
TaskManager
andTaskBuilder
for managing and executing tasks.
-
Cron Scheduler and Jobs:
- Added support for scheduling recurring tasks with a new cron scheduler. This feature allows you to define and manage jobs that run at specified intervals.
-
Enhanced Modules and Controllers:
- Made significant improvements to the framework's modules and controllers for better organization, flexibility, and ease of use.
-
Bug Fixes:
- Addressed several major bugs to enhance the stability and reliability of the framework.
-
General Improvements:
- Various performance enhancements and optimizations to improve the overall functionality and efficiency of the framework.
-
Documentation:
- Added comprehensive Godoc documentation for all implementations, making it easier to understand and utilize the framework's features.
Breaking Changes
- No breaking changes in this release. All updates are backward-compatible with previous versions.
Installation and Upgrade
To upgrade to version v0.3.0, use the following command:
go get github.com/hokamsingh/[email protected]
Documentation
For detailed documentation on the new features and improvements, please refer to the updated LessGo Documentation.
Thank you for using LessGo! We appreciate your feedback and contributions. For more details, refer to our documentation or contact our support team.
Happy coding! 🚀
Contributors:
- Hokam Singh (@hokamsingh)
- The LessGo Community
Release Date: August 2024
Full Changelog: v0.2.10...v0.3.0
v0.2.10
Release Notes - LessGo v0.2.10
Overview
We are excited to announce the release of LessGo v0.2.10! This release introduces significant improvements to the lessgo
framework, including enhancements to dependency injection, global application management, middleware handling, and routing capabilities. These updates aim to provide a more robust and flexible framework for building Go applications.
New Features & fixes
-
Improved Dependency Injection (DI):
- Enhanced the DI container to support advanced features including named dependencies and scoped services.
- Added a global
App
instance for easier access to the core application functionalities without the need to pass it around explicitly.
-
Global Application Management:
- Introduced global access to the
App
instance, allowing modules and components to interact with the application context without direct dependency injection.
- Introduced global access to the
-
Sub Routing Enhancements:
- Improved sub-routing capabilities to allow middleware to be applied selectively to specific subrouters.
- Added support for applying middleware only to subrouters, avoiding unnecessary application to the root router.
-
Enhanced Middleware Handling:
- Refined middleware functionality to support advanced use cases, including dynamic middleware application based on router hierarchy.
-
Bootstrap and Module Binding:
- Streamlined the application bootstrap process with a more intuitive setup for registering and binding modules.
- Simplified module registration and management using the improved DI container and global
App
instance.
-
Updated Routing and Middleware Architecture:
- Enhanced routing capabilities with better support for handling static files and applying middleware.
- Improved subrouter creation and middleware application, ensuring more flexible routing configurations.
-
New
Listen
Method:- Added the
Listen
method to start the HTTP server, providing a straightforward way to initiate server operations with custom configurations.
- Added the
Breaking Changes
- Subrouter middleware application has been updated, which may impact existing middleware setups that were previously applied globally.
Bug Fixes
- Fixed various issues related to middleware application in subrouters.
- Addressed bugs in module registration and dependency injection handling.
Installation and Upgrade
To upgrade to version v0.2.10, use the following command:
go get github.com/hokamsingh/[email protected]
Documentation
For detailed documentation on the new features and improvements, please refer to the updated LessGo Documentation.
Thank you for using LessGo! As always, we appreciate your feedback and contributions. For more details, refer to our documentation or contact our support team.
Happy coding! 🚀
Contributors:
- Hokam Singh (@hokamsingh)
- The LessGo Community
Release Date: August 2024
v0.2.9
Release Notes - LessGo v0.2.9
Overview
We are excited to announce the release of LessGo v0.2.9! This update introduces several new features and improvements to enhance the functionality and robustness of your web applications.
New Features
-
Enhanced Response Handling
ctx.JSON(status int, v interface{})
: Simplify sending JSON responses with automatic content-type setting and status code handling.ctx.Error(status int, message string)
: Streamline error responses with a standardized JSON format for errors.ctx.Send(v any)
: Send plain text responses with customizable content-type settings.
-
Parameter Access
- Query Parameters: Retrieve all query parameters from the request as a JSON object with
ctx.GetAllQuery()
. - Path Parameters: Access all URL parameters with
ctx.GetAllParams()
.
- Query Parameters: Retrieve all query parameters from the request as a JSON object with
-
Cookie Management
ctx.SetCookie(name, value string, maxAge int, path string)
: Set cookies with customizable options.ctx.GetCookie(name string) (string, bool)
: Retrieve cookie values from the request.
-
Header Management
ctx.SetHeader(key, value string)
: Easily set custom headers for the response.
-
Response Prevention
- Prevention of Multiple Responses: Once a response is sent, further attempts to send additional data or headers are now prevented, ensuring that only one response is processed per request. This helps avoid issues with multiple responses or inconsistent output.
-
Static File Serving
ServeStatic(prefix string, folderPath string)
: Abstract static file serving into a reusable function, making it easier to serve static files from your application.
Example Usage
-
Sending JSON Response:
ctx.JSON(http.StatusOK, map[string]string{"message": "success"})
-
Error Handling:
ctx.Error(http.StatusBadRequest, "Invalid request")
-
Sending Plain Text:
ctx.Send("Hello, world!")
-
Query and Path Parameters:
params, _ := ctx.GetAllParams() queryParams, _ := ctx.GetAllQuery()
-
Cookies:
ctx.SetCookie("session_id", "123456", 3600, "/") value, ok := ctx.GetCookie("session_id")
-
Custom Headers:
ctx.SetHeader("X-Custom-Header", "MyValue")
-
Static File Serving:
r.ServeStatic("/static/", "path/to/content/dir")
Bug Fixes and Improvements
- Fixed issues related to handling multiple responses and ensuring consistent response behavior.
- Improved static file serving functionality and usability.
Thank you for using LessGo! As always, we appreciate your feedback and contributions. For more details, refer to our documentation or contact our support team.
Happy coding! 🚀
Contributors:
- Hokam Singh (@hokamsingh)
- The LessGo Community
Release Date: August 2024
LessGo v0.2.8
Release Notes
We are excited to announce the release of LessGo v0.2.8, which brings several powerful new features and improvements to our lightweight, Go-based web framework. This version introduces enhanced request and response handling, streamlined routing capabilities, and more robust context management. Here's what's new:
New Features
-
Custom Context (
Context
) Integration- Enhanced Request and Response Handling: Introducing a custom
Context
structure (Context
) that provides utility methods for accessing request parameters, handling request bodies, and sending JSON responses. This makes it easier to work with HTTP requests and responses in a more expressive and convenient way. - Request Body Parsing: The
Context
now includes aBody
method to parse JSON request bodies into Go structs. This simplifies the handling of incoming data while ensuring type safety and ease of use. - JSON Response Handling: The
Context
provides aJSON
method that streamlines the process of sending JSON responses to the client. It automatically sets theContent-Type
header and encodes the response data into JSON format.
- Enhanced Request and Response Handling: Introducing a custom
-
Routing Enhancements
- Express-style HTTP Methods: LessGo now supports all standard HTTP methods (GET, POST, PUT, DELETE, etc.) directly within the router. You can now define routes using expressive methods like
r.Get
,r.Post
,r.Put
, andr.Delete
, making route definitions cleaner and more intuitive. - Route Middleware Support: The framework now supports middleware chaining for routes. Middleware functions can be applied to routes to handle tasks such as request logging, error handling, and CORS management.
- Express-style HTTP Methods: LessGo now supports all standard HTTP methods (GET, POST, PUT, DELETE, etc.) directly within the router. You can now define routes using expressive methods like
-
Request Body Persistence
- Non-destructive JSON Parsing: The framework's JSON parser middleware now reads and stores the request body without consuming it. This allows the body to be accessed multiple times, ensuring that your handlers can always access the original request data.
- Accessor for Parsed JSON Body: A new
GetJSONBody
method has been added to theContext
, allowing easy retrieval of the parsed JSON body from the request context. This provides a seamless way to work with request data across different parts of your application.
-
Utilities and Middleware
- Serve Static Files: The framework now includes improved support for serving static files, with easy-to-use methods for defining static file directories.
- Middleware Enhancements: Middleware functions for CORS, rate limiting, and JSON parsing have been refined to work seamlessly with the new context and routing features.
Bug Fixes and Improvements
- Improved Error Handling: Enhanced error handling within the context and middleware, ensuring more informative error messages and smoother request processing.
- Optimized Performance: Various optimizations to the request handling pipeline to reduce overhead and improve response times.
- Refactoring and Code Cleanup: Significant refactoring of the internal codebase for better maintainability and extensibility.
Breaking Changes
- CustomHandler to http.HandlerFunc Conversion: The introduction of custom context handling may require updates to existing handlers. Make sure to wrap existing
http.HandlerFunc
handlers using the new context-aware methods to maintain compatibility.
We hope you find these new features and improvements valuable as you continue to build with LessGo. As always, we welcome your feedback and contributions. Happy coding!
Contributors:
- Hokam Singh (@hokamsingh)
- The LessGo Community
Release Date: August 2024
LessGo Beta
🛠️ LessGo Framework Release
We are excited to announce the latest release of the LessGo framework! This release introduces several powerful features and enhancements to make your Go development experience even more robust and efficient.
🚀 New Features
-
Enhanced Dependency Injection (DI):
- Conditional Bindings: Register dependencies based on specific conditions.
- Scoped Services: Manage services with different lifetimes and scopes.
- Named Dependencies: Support for naming dependencies for more granular control.
-
Dynamic Configuration Management:
- Factory Pattern: Implement dynamic configuration management with factories to handle various application environments and requirements.
-
Inbuilt Error Handling:
- Custom Error Responses: Integrate a flexible error handling system that returns appropriate HTTP responses based on the error type.
- Detailed Logging: Capture detailed error logs and stack traces for better debugging.
-
Job Scheduler Integration:
- Built-in Scheduler: Utilize an advanced job scheduling library for managing periodic tasks and background jobs seamlessly.
-
JSON Response Handling:
- Automatic JSON Parsing: Simplify the process of parsing and responding with JSON data.
- Custom JSON Encoding: Encode and decode JSON responses with integrated error handling.
-
Advanced Data Validation:
- Strict Validation: Ensure data integrity by validating incoming requests against predefined models.
- Dynamic Key Checks: Verify that all required fields are present in the request payload.
📚 Documentation & Examples
- Enhanced Documentation: Comprehensive guides and examples to help you get started with the new features and integrations.
- Code Examples: Practical examples demonstrating how to use the new features in real-world applications.
🛠️ Improvements & Fixes
- Performance Enhancements: Optimizations for better performance and reduced resource usage.
- Bug Fixes: Various bug fixes and stability improvements to ensure a smoother development experience.
📦 Installation & Upgrade
To get started with the latest version of LessGo, update your dependencies using:
go get github.com/hokamsingh/lessgo@latest
For detailed upgrade instructions and migration guides, please refer to our documentation.
🙌 Acknowledgments
We would like to thank our contributors and community for their support and feedback. Your contributions have been invaluable in shaping the LessGo framework.
For any questions, issues, or feedback, please visit our GitHub repository or join our community discussions.
Happy coding!
LessGo Basic
v0.2.5 feat: utility function and file serving features support