Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
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));
});