v1.0.0
π GamanJS Release Notes
β οΈ Node.js Version Requirement
Important: This version of GamanJS requires Node.js >= v18.20.8. Please update your Node.js installation if you're using an older version.
π Bug Fixes
Fixed Method Route Responsiveness Issue
Fixed a critical issue where method routes were not responding correctly to different HTTP methods.
Before (Broken):
routes: {
"/": {
GET: () => "OK",
POST: () => "OK (POST)"
}
}Previously, making a POST request would incorrectly execute the GET handler instead of the POST handler. This has been resolved.
Now (Fixed): All HTTP methods now correctly route to their respective handlers.
β¨ New Features
Strict Route Matching
Introduced strict route matching functionality for more precise URL handling.
defineBlock({
strict: true
})strict: true- Routes must match exactly, including trailing slashes (e.g.,/dashboard/user/requires the trailing slash)strict: falseor omitted - Flexible matching, works with or without trailing slashes
Examples:
// Strict mode - must include trailing slash
"/dashboard/user/" β
matches
"/dashboard/user" β doesn't match
// Non-strict mode - both work
"/dashboard/user/" β
matches
"/dashboard/user" β
matchesSession Helper Context Support
Added comprehensive session management with pluggable storage drivers.
New Session API:
// Set session data
await ctx.session.set('user_id', '12345');
await ctx.session.set('user_data', { name: 'John', role: 'admin' });
// Get session data
const userId = await ctx.session.get('user_id');
const userData = await ctx.session.get('user_data');
// Check if session exists
const hasUser = await ctx.session.has('user_id');
// Delete session data
await ctx.session.delete('user_id');Supported Storage Drivers:
- cookies - Stateless signed cookies (default)
- memory - In-memory storage for development
- file - File-based storage
- redis - Redis storage for production
- sql - SQLite database storage
- mongodb - MongoDB NoSQL storage
Usage Example:
import { session } from 'gaman/integrations';
// Basic setup with cookies
integrations: [session()]
// With Redis
integrations: [session({
driver: { type: 'redis', url: 'redis://localhost:6379' },
secret: 'your-secret-key',
maxAge: 3600
})]For more details, see merge tag [#13](../../pull/13).
π¦ Package Consolidation
Deprecated Standalone Packages
The following standalone packages have been deprecated and are now built into GamanJS core:
@gaman/corsβgaman/cors@gaman/ejsβgaman/ejs@gaman/basic-authβgaman/basic-auth@gaman/nunjucksβgaman/nunjucks- And other
@gaman/*packages
Migration Guide:
// OLD - Deprecated
import cors from '@gaman/cors';
import ejs from '@gaman/ejs';
import basicAuth from '@gaman/basic-auth';
// NEW - Built-in
import cors from 'gaman/cors';
import ejs from 'gaman/ejs';
import basicAuth from 'gaman/basic-auth';Benefits:
- β Reduced dependency management
- β Better version compatibility
- β Simplified installation process
- β Faster startup times
π Breaking Changes
- Node.js Version: Minimum required version is now v18.20.8
- Package Imports: Update import statements from
@gaman/*togaman/*
π Improvements
- Enhanced route matching accuracy
- Better session management capabilities
- Streamlined package architecture
- Improved developer experience