Skip to content

jokio/capacitor-web-server

Repository files navigation

capacitor-web-server

Web Server for iOS and Android

Install

npm install capacitor-web-server
npx cap sync

API

start(...)

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()

stop() => Promise<void>

onRequest(...)

onRequest(callback: PluginCallback) => Promise<void>
Param Type
callback PluginCallback

sendResponse(...)

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>; }

Interfaces

PluginResultData

PluginResultError

Prop Type
message string

Type Aliases

PluginCallback

(data: PluginResultData, error?: PluginResultError): void

Record

Construct a type with a set of properties K of type T

{ [P in K]: T; }