asi-calculator/middleware.ts
Matthias Kretschmann dd44cc864e
market data refactor, add 24h price change (#8)
* new prices data structure

* market data refactor, add 24h price change

* browser language detection with middleware

* middleware tweaks
2024-04-09 13:46:15 +01:00

12 lines
346 B
TypeScript

import { NextResponse, type NextRequest } from 'next/server'
export function middleware(request: NextRequest) {
// add x-locale header to all responses
const locale =
request.headers.get('accept-language')?.split(',')?.[0] || 'en-US'
const response = NextResponse.next()
response.headers.set('x-locale', locale)
return response
}