A webserver interface to the same methods and code that Cordova plugins install.

Overview

cordova-plugin-webserver

Cordova plugin for localhost web server written in Kotlin and Ktor

Install plugin

cordova plugin add https://github.com/Qbix/cordova-plugin-webserver.git

Supported platforms

Let's start

  • First step: In your index.js file add this line to start the web server
cordova.plugins.webServer.startServer(function(result) { console.log(result); }, function(error) { console.log(error); })
  • Second step: Build and run your app. Voila, enjoy the web server!

Start Server

cordova.plugins.webServer.startServer(function(result) { console.log(result); }, function(error) { console.log(error); })

Stop Server

cordova.plugins.webServer.stopServer(function(result) { console.log(result); }, function(error) { console.log(error); })

Requests

Serving static content

GET request:

http://localhost:3005/static-content/{your path from assets directory}

Example with serving index.html:

http://localhost:3005/static-content/www/index.html

Executing Cordova methods

POST request:

curl -X POST -F service=CordovaServiceName -F action=CordovaMethod -F args=["Args"] http://localhost:3005/cordova-request

Example with common cordova request:

Q.Users.Cordova.Labels.get(["e"], function(data) { console.log(data); }, function(err) { console.log(err); })

equivalent to

curl -X POST -F service=QUsersCordova -F action=get -F args=[["e"]] http://localhost:3005/cordova-request

Common errors

  • Not found - if static content is not found.
  • Service not found - if the web server could not find the service or the structure of the post request was incorrect.
  • Invalid action execution - if the web server could not find the action or the structure of the post request was incorrect.
  • Gateway timeout - if the web server could not execute cordova request within the timeout.
  • Different callbackId - when we run our Cordova request we generate a callbackId, if we get a callbackId different than our callbackId we return an error.
  • Plugin manager is null - something wrong happened after initialization.
  • Plugin response is null - if plugin response is null.
You might also like...
IntelliJ Plugin for Android Parcelable boilerplate code generation.
IntelliJ Plugin for Android Parcelable boilerplate code generation.

IntelliJ/Android Studio Plugin for Android Parcelable boilerplate code generation This tool generates an Android Parcelable implementation based on fi

A plugin for Jetbrains IDE, Your code is powerful, unleash it like playing osu!

Osu! Mode A plugin for Jetbrains IDE, Your code is powerful, unleash it like playing osu! Demo 2021-10-15.18-50-30.mp4 Bilibili Feature open project /

Intellij Idea Plugin that can convert HTML to Compose for Web code.
Intellij Idea Plugin that can convert HTML to Compose for Web code.

HtmlToComposeWebConverter Intellij Idea Plugin that can convert HTML to Compose for Web code. Turn this: Into this: Show some ❤️ and star the repo to

Intellij-angular-split-buttons - IntelliJ Plugin for adding hovering buttons to Angular component files to quickly open the code An IntelliJ IDEA plugin is used to inspire you to write code.
An IntelliJ IDEA plugin is used to inspire you to write code.

InspireWritingPlugin An IntelliJ IDEA plugin is used to inspire you to write code. Whenever you write code that exceeds the specified character, the p

Ownership-gradle-plugin - Gradle code ownership verification plugin

Gradle code ownership verification plugin A gradle plugin that will verify owner

Social share - Social Sharing Plugin For Private Use only (Code without error checking)
Social share - Social Sharing Plugin For Private Use only (Code without error checking)

Flutter Social Share plugin for sharing file to media with multiple (More option

Dokka plugin to render Mermaid graphics, from your code comments to your Dokka documentation.
Dokka plugin to render Mermaid graphics, from your code comments to your Dokka documentation.

Dokka plugin to render Mermaid graphics, from your code comments to your Dokka documentation.

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.

Gradle Play Publisher Gradle Play Publisher is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and

Owner
Qbix
Empowering People. Uniting Communities.
Qbix
⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the web

Capacitor Firebase ⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the web. Maintainers Maintainer GitHub Social Robin Genz robingenz @ro

Robin Genz 179 Dec 30, 2022
Android gradle version and plugins

android-gradle-plugin Android gradle version and plugins Version catalogs Shared catalogs 를 사용한 android version catalogs 입니다. Usage settings.gradle.kt

null 2 Aug 26, 2022
My (terrible) plugins for Aliucord

Plugins for Aliucord How to install: Join the Aliucord support server long press on my message in #plugins-list then click "Open PluginDownloader" Man

Animal 37 Nov 3, 2022
My plugins for Aliucord, an android Discord client mod

Ven's Aliucord Plugins Click a Plugin's name to open a more detailed explanation Themer - Download Create and apply custom themes EmojiUtility - Downl

Ven 139 Dec 28, 2022
Library for testing highlighting in plugins for IDEA in KPHP format.

intellij-kphp-highlighting-test-adapter Library for testing highlighting in plugins for IDEA in KPHP format. Installation Kotlin DSL plugins { id(

Makhnev Petr 2 Jul 23, 2022
IntelliJ plugin that provides a modern and powerful byte code analyzer tool window.

IntelliJ Byte Code Analyzer Plugin This IntelliJ plugin provides a modern and powerful byte code analyzer tool window. Its supports Java, Kotlin, Groo

Marcel Kliemannel 29 Nov 9, 2022
CKlib is a gradle plugin that will build and package C/C++/Objective-C code for Kotlin/Native.

C Klib CKlib is a gradle plugin that will build and package C/C++/Objective-C code for Kotlin/Native. The Problem When you want to access C-etc code f

Touchlab 73 Nov 8, 2022
Process jacoco reports and print the code coverage to the Azure DevOps

PrintCoverage PrintCoverage plugin allows you easily integrate coverage badge into your Azure DevOps pull requests! How to use In the module build.gra

Intermedia Cloud Communications 4 Oct 15, 2021
Manage pull requests and conduct code reviews in your IDE with full source-tree context.

String Manipulation IntelliJ plugin - https://plugins.jetbrains.com/plugin/2162 Sponsored by Manage pull requests and conduct code reviews in your IDE

Vojtěch Krása 582 Dec 22, 2022
UTBotJava generates test cases by code, trying to cover maximum statements and execution paths.

UTBotJava generates test cases by code, trying to cover maximum statements and execution paths. We treat source code as source of truth assuming that behavior is correct and corresponds to initial user demand. Generated tests are placed in so-called regression suite

null 60 Jan 3, 2023