All Projects → apache → cordova-serve

apache / cordova-serve

Licence: Apache-2.0 license
Apache Cordova Serve Library

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cordova-serve

cordova-plugin-advanced-imagepicker
Cordova Plugin for an advanced (multiple) ImagePicker
Stars: ✭ 23 (+53.33%)
Mutual labels:  cordova
cordova-tizen
[DEPRECATED] Apache Cordova Tizen
Stars: ✭ 31 (+106.67%)
Mutual labels:  cordova
ImageDetectionCordovaPlugin
Image detection cordova plugin
Stars: ✭ 99 (+560%)
Mutual labels:  cordova
cordova-plugin-purchases
Cordova in-app purchases and subscriptions made easy.
Stars: ✭ 52 (+246.67%)
Mutual labels:  cordova
Kaput
Kişisel araç takip yazılımı
Stars: ✭ 69 (+360%)
Mutual labels:  cordova
cordova-line-login-plugin
A cordova plugin for easy implementation of LINE login using LineSDK.
Stars: ✭ 20 (+33.33%)
Mutual labels:  cordova
docker-cordova
🗿 Docker image for Cordova (with Node.js & Android)
Stars: ✭ 72 (+380%)
Mutual labels:  cordova
ionic4-angular7-example
Ionic 4, Angular 7 and Cordova Tutorial: Build CRUD Mobile Apps
Stars: ✭ 57 (+280%)
Mutual labels:  cordova
elm-cordova-intro
Getting started with Elm, Cordova and Fastlane
Stars: ✭ 16 (+6.67%)
Mutual labels:  cordova
AQMissionHelper
Route to the next Onyx - A mission helper tool for Niantic Ingress - Learn more at http://imaq.cn/mh/
Stars: ✭ 12 (-20%)
Mutual labels:  cordova
phonegap-template-vue-f7-tabs
A TabBar PhoneGap template using Vue.js and Framework7
Stars: ✭ 31 (+106.67%)
Mutual labels:  cordova
cordova-wp8
[DEPRECATED] Apache Cordova WP8
Stars: ✭ 83 (+453.33%)
Mutual labels:  cordova
Create-a-custom-Cordova-plugin
How to create a custom cordova plugin and bridge it between your native code and a new or existing Cordova project
Stars: ✭ 32 (+113.33%)
Mutual labels:  cordova
mipush-cordova-plugin
cordova小米推送插件
Stars: ✭ 22 (+46.67%)
Mutual labels:  cordova
cordova-medic
[DEPRECATED] Apache Cordova Medic
Stars: ✭ 17 (+13.33%)
Mutual labels:  cordova
JiaCordova
在Cordova及插件的基础上封装一些常用的功能,不断更新中
Stars: ✭ 35 (+133.33%)
Mutual labels:  cordova
cordova-study
📱 Cordova学习记录,Cordova插件的使用,热更新、media、device、集成x5内核等等。
Stars: ✭ 19 (+26.67%)
Mutual labels:  cordova
ionic3-angular4-sample-app
Sample app of Ionic 3 and Angular 4
Stars: ✭ 35 (+133.33%)
Mutual labels:  cordova
cordova-plugin-downloadmanager
A Cordova plugin to download file in system's default download manager
Stars: ✭ 45 (+200%)
Mutual labels:  cordova
cordova-build-architecture
Force cordova to build for arm or x86. Useful on PhoneGap Build.
Stars: ✭ 34 (+126.67%)
Mutual labels:  cordova

cordova-serve

NPM

Node CI

This module provides a JavaScript API to serve up a Cordova application in the browser.

API Example:

const cordovaServe = require('cordova-serve')();

cordovaServe.launchServer(options);
cordovaServe.servePlatform(platform, options);
cordovaServe.launchBrowser(options);

API Methods

launchServer()

Launches a local HTTP server.

Code Example:

const cordovaServe = require('cordova-serve')();

cordovaServe.launchServer(options).then(function () {
    const { server, port, root } = cordovaServe;
    ...
}, error => {
    console.log(`An error occurred: ${error}`);
});

Parameters:

  • options: described below in the following section "launchServer & servePlatform Options".

Return:

Returns a resolved or rejected promise depending on if the server had launched successfully.

On a fulfilled promise, the following properties are available on the returned object:

Property Description
serve The Node http.Server instance.
root The root that was specified, or cwd if none specified.
port The port that was used. (Either the requested port, the default port of 8000, or the incremented value of the chosen port when the chosen port is already in use).

servePlatform()

Launches a server that serves up any Cordova platform (e.g. browser, android, etc) from the current project.

Code Example:

const cordovaServe = require('cordova-serve')();

cordovaServe.servePlatform(platform, options).then(() => {
    const { server, port, projectRoot, root } = cordovaServe;
    ...
}, error => {
    console.log(`An error occurred: ${error}`);
});

Parameters:

  • options: described below in the following section "launchServer & servePlatform Options".

Return:

Note that for servePlatform(), the root value should be a Cordova project's root folder or any folder within it. servePlatform() will replace it with the platform's www_dir folder. If this value is not specified, the cwd will be used.

Returns a resolved or rejected promise depending on if the server had launched successfully.

On a fulfilled promise, the following properties are available on the returned object:

Property Description
serve The Node http.Server instance.
root The requested platform's www folder.
projectRoot The root folder of the Cordova project.
port The used port. requested port, the default port 8000, or incremented value of the chosen port when already in use).

launchBrowser()

Launches a browser window pointing to the specified URL.

Code Example:

const cordovaServe = require('cordova-serve')();

cordovaServe.launchBrowser(options).then(
  stdout => {
    console.log(`Browser was launched successfully: ${stdout}`);
  },
  error => {
    console.log(`An error occurred: ${error}`);
  }
);

Parameters:

  • options (optional):
Options Description
url The URL to open in the browser.
target The browser identifier to launch. Valid identifier: chrome, chromium, firefox, ie, opera, safari. (Default: chrome.)

Return:

Returns a resolved or rejected promise depending on if the browser had launched successfully.

launchServer & servePlatform Options

The options object passed to launchServer() and servePlatform() supports the following values (all optional):

Options Description
root The file path on the local file system that is used as the root for the server, for default mapping of URL path to the local file system path.
port The port for the server. Note that if this port is already in use, it will be incremented until a free port is found.
router An ExpressJS router. If provided, this will be attached before default static handling.
noLogOutput If true, all log output will be turned off.
noServerInfo If true, the Static file server running on... message will not be outputed.
events An EventEmitter to use for logging. If provided, logging will be output using events.emit('log', msg). If not provided, console.log() will be used. Note that nothing will be output in either case if noLogOutput is true.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].