Web Server for iOS and Android
npm install capacitor-web-server
npx cap sync
start(props: { deviceName?: string; port?: number; publicFolderPath?: string; apiPath?: string; }) => Promise<{ serverUrl: string; }>
Param | Type |
---|---|
props |
{ deviceName?: string; port?: number; publicFolderPath?: string; apiPath?: string; } |
Returns: Promise<{ serverUrl: string; }>
stop() => Promise<void>
onRequest(callback: PluginCallback) => Promise<void>
Param | Type |
---|---|
callback |
PluginCallback |
sendResponse(props: { requestId: string; body: string; status?: number; headers?: Record<string, string>; }) => Promise<void>
Param | Type |
---|---|
props |
{ requestId: string; body: string; status?: number; headers?: Record<string, string>; } |
Prop | Type |
---|---|
message |
string |
(data: PluginResultData, error?: PluginResultError): void
Construct a type with a set of properties K of type T
{
[P in K]: T;
}