![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
cordova-serve
Advanced tools
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(opts);
serve.launchBrowser(target, url);
serve.sendStream(filePath, request, response[, readStream]);
##launchServer()
launchServer(opts);
Launches a server with the specified options. Parameters:
##servePlatform()
servePlatform(opts);
Launches a server that serves up any Cordova platform (e.g. browser
, android
etc) from the current project.
Parameters:
##launchBrowser()
launchBrowser(target, url);
Launches a browser window pointing to the specified URL. Parameters:
chrome
, chromium
, firefox
, ie
,
opera
, safari
.##sendStream()
sendStream(filePath, request, response[, readStream]);
The server uses this method to stream files, and it is provided as a convenience method you can use if you are
customizing the stream by specifying opts.streamHandler
. Parameters:
streamHandler
).streamHandler
).streamHandler
).##The opts Options Object
The opts object passed to launchServer()
and servePlatform()
supports the following values:
servePlatform()
, this value should be the Cordova project's root folder, or any
folder within it - servePlatform()
will replace it with the platform's www_dir
folder.cordova-serve
will by default
treat the URL as relative to the platform's www_dir
, but will first call this method, if provided, to support
custom handling.cordova-serve
will by default stream files using
sendStream()
, described above, which just streams files, but will first call this method, if provided, to
support custom streaming. This method is described in more detail below.##urlPathProcessor() Provide this method if you need to do custom processing of URL paths. That is, custom mapping of URL path to local file path. The signature of this method is as follows:
urlPathProcessor(urlPath, request, response, do302, do404)
Parameters:
url.parse(request.url).pathname
.Return value:
Broadly, there are three possible actions you can take in your urlPathProcessor
handler:
response.end()
.
In this scenario, you should return null
.{filePath: <value>}
,
where <value>
is the local file path.{filePath: null}
.##streamHandler() Provide this method if you wish to perform custom stream handling. The signature of this method is as follows:
streamHandler(filePath, request, response)
Parameters:
sendStream()
,
it is useful if even a fake file name has a file extension, as that is used for mime type lookup.Return value:
Return true
if you have handled the stream request, otherwise false
.
##serverExtender()
If you provide this method, it will be called as soon as the server is created. It allows you to attach additional functionality to the server, such has event handlers, web sockets etc. The signature of this method is as follows:
serverExtender(server, root)
Parameters:
http.createServer()
).FAQs
Apache Cordova server support for cordova-lib and cordova-browser.
The npm package cordova-serve receives a total of 28,467 weekly downloads. As such, cordova-serve popularity was classified as popular.
We found that cordova-serve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.