How to use the cordova-serve.Router function in cordova-serve

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();
        });

cordova-serve

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

Apache-2.0
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis

Popular cordova-serve functions