Change8

fetch-router@0.9.0

📦 remixView on GitHub →
4 features🔧 6 symbols

Summary

This release introduces several new middleware options for session management, static file serving, and async context tracking, along with a new response helper for file delivery.

Migration Steps

  1. To use the new session management, import 'session' from '@remix-run/fetch-router/session-middleware' and add it to your router's middleware array.
  2. To enable global context access, add 'asyncContext()' from '@remix-run/fetch-router/async-context-middleware' to your middleware configuration.
  3. Update file serving routes to use the 'res.file(file, request)' helper from '@remix-run/fetch-router/response-helpers'.

✨ New Features

  • Added 'session' middleware for automatic management of 'context.session' across requests using cookies and storage providers.
  • Added 'asyncContext' middleware to store request context in AsyncLocalStorage, making it accessible to all functions in the same execution context.
  • Added 'file' response helper to simplify serving file objects with request handling.
  • Added 'staticFiles' middleware for serving static assets from a specified directory.

🔧 Affected Symbols

sessionasyncContextfilestaticFilescreateRoutergetContext