How to use cordova-serve - 4 common examples

To help you get started, we’ve selected a few cordova-serve examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / cordova-lib / src / cordova / serve.js View on Github external
function platformRouter (platform) {
    const { configXml, www } = platforms.getPlatformApi(platform).getPlatformInfo().locations;
    const router = cordovaServe.Router();
    router.use('/www', cordovaServe.static(www));
    router.get('/config.xml', (req, res) => res.sendFile(configXml));
    router.get('/project.json', (req, res) => res.send({
        configPath: `/${platform}/config.xml`,
        wwwPath: `/${platform}/www`,
        wwwFileList: generateWwwFileList(www)
    }));
    return router;
}
github apache / cordova-lib / spec / cordova / serve.spec.js View on Github external
beforeEach(() => {
            spyOn(cordovaUtil, 'listPlatforms').and.returnValue(['foo']);
            serve.__set__({
                handleRoot: jasmine.createSpy('handleRoot'),
                absolutePathHandler: jasmine.createSpy('absolutePathHandler'),
                platformRouter: jasmine.createSpy('platformRouter')
                    .and.returnValue(_ => _)
            });
            registerRoutes = serve.__get__('registerRoutes');
            app = new cordovaServe.Router();
        });
github apache / cordova-lib / src / cordova / serve.js View on Github external
function platformRouter (platform) {
    const { configXml, www } = platforms.getPlatformApi(platform).getPlatformInfo().locations;
    const router = cordovaServe.Router();
    router.use('/www', cordovaServe.static(www));
    router.get('/config.xml', (req, res) => res.sendFile(configXml));
    router.get('/project.json', (req, res) => res.send({
        configPath: `/${platform}/config.xml`,
        wwwPath: `/${platform}/www`,
        wwwFileList: generateWwwFileList(www)
    }));
    return router;
}
github apache / cordova-lib / cordova-lib / src / cordova / serve.js View on Github external
installedPlatforms.forEach(function (platform) {
                var locations = platforms.getPlatformApi(platform).getPlatformInfo().locations;
                server.app.use('/' + platform + '/www', serve.static(locations.www));
                server.app.get('/' + platform + '/*', getPlatformHandler(platform, locations.www, locations.configXml));
            });

cordova-serve

Apache Cordova server support for cordova-lib and cordova-browser.

Apache-2.0
Latest version published 2 years ago

Package Health Score

69 / 100
Full package analysis

Popular cordova-serve functions