rasengan
Version:
The modern React Framework
50 lines (49 loc) • 1.98 kB
TypeScript
import { ServerMode } from '../runtime/mode.js';
import { StaticHandlerContext } from 'react-router';
import { Metadata } from '../../routing/types.js';
import type * as Express from 'express';
import { Redirect } from '../../core/config/type.js';
export default function getIPAddress(): string;
/**
* Log server info after the server is started
* @param {number} port The port the server is running on
* @param {boolean} isProduction Whether the server is running in production mode
* @param {boolean} open Whether to open the browser automatically
*/
export declare function logServerInfo(port: number, mode: ServerMode, open?: boolean): Promise<void>;
/**
* This function extracts the meta data from the React Router context
* @param context React Router context
*/
export declare function extractMetaFromRRContext(context: StaticHandlerContext): {
page: Metadata;
layout: Metadata;
};
/**
* This function extracts the headers from the React Router context
* @param context React Router context
*/
export declare function extractHeadersFromRRContext(context: StaticHandlerContext): Headers;
/**
* Check if the request is a document request
* @param request Express request object
*/
export declare function isDocumentRequest(request: Express.Request): boolean;
export declare function isDataRequest(request: Express.Request): boolean;
export declare function isResourceRequest(request: Express.Request): boolean;
/**
* Check if the request is an Redirect request
* @param context Response context
*/
export declare function isRedirectResponse(context: Response): boolean;
/**
* Check if the request is a static redirect from the config file
* @param req Express request object
* @param redirects Redirects from the config file
*/
export declare function isStaticRedirectFromConfig(req: Express.Request, redirects: Redirect[]): Promise<boolean>;
/**
* Generate a random port
* @returns
*/
export declare function generateRandomPort(): number;