![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(platform, opts);
serve.launchBrowser(ops);
serve.sendStream(filePath, request, response[, readStream][, noCache]);
launchServer(opts);
Launches a server with the specified options. Parameters:
servePlatform(platform, opts);
Launches a server that serves up any Cordova platform (e.g. browser
, android
etc) from the current project.
Parameters:
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(opts);
Launches a browser window pointing to the specified URL. The single parameter is an options object that supports the following values (both optional):
chrome
, chromium
, firefox
, ie
,
opera
, safari
. If no browser is specified,sendStream(filePath, request, response[, readStream][, noCache]);
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 object passed to launchServer()
and servePlatform()
supports the following values (all optional):
response.write()
, or determine a custom local file path and call serveFile()
to
serve it up, or do no processing and call serveFile
with no params to treat urlPath
as relative to the root.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.Provide this method if you need to do custom processing of URL paths (that is, custom mapping of URL path to local file path) and potentially directly handle serving up the resulting data. The signature of this method is as follows:
urlPathHandler(urlPath, request, response, do302, do404, serveFile)
Parameters:
url.parse(request.url).pathname
.urlPathHandler()
doesn't write the response itself,
it should call this method either passing it the local file path to be served, or passing it nothing. In the latter case,
it will treat urlPath
as relative to the root.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
.
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.