Code Monkey home page Code Monkey logo

cordova-serve's Introduction

cordova-serve

This module can be used to serve up a Cordova application in the browser. It has no command-line, but rather is intended to be called using the following API:

var serve = require('cordova-serve');
serve.launchServer(opts);
serve.servePlatform(platform, opts);
serve.launchBrowser(ops);

launchServer()

launchServer(opts);

Launches a server with the specified options. Parameters:

  • opts: Options, as described below.

servePlatform()

servePlatform(platform, opts);

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

  • opts: Options, as described below. 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.

launchBrowser()

launchBrowser(opts);

Launches a browser window pointing to the specified URL. The single parameter is an options object that supports the following values (both optional):

  • url: The URL to open in the browser.
  • target: The name of the browser to launch. Can be any of the following: chrome, chromium, firefox, ie, opera, safari. If no browser is specified,

The opts Options Object

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

  • 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 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, turns off all log output.
  • noServerInfo: If true, cordova-serve won't output Static file server running on... message.
  • 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.

cordova-serve's People

Watchers

Ryan Willis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.