README
static-handler
:boom: [ESM] The static handler for Node.js according to rfc7230, rfc7231, rfc7232, rfc7233, rfc7234 and whatwg
Example
Full example in /example
folder.
import { REDIRECT_STATUS_CODES, rewriteHandler } from '@awesomeorganization/rewrite-handler'
import { http } from '@awesomeorganization/servers'
import { staticHandler } from '@awesomeorganization/static-handler'
const example = async () => {
const rewriteMiddleware = rewriteHandler({
rules: [
{
pattern: '^/old-files/(.*)',
replacement: '/files/$1',
statusCode: REDIRECT_STATUS_CODES.MOVED_PERMANENTLY,
},
{
pattern: '(.*)/