function attach(app) { app.get('/simulator/', streamSimHostHtml); app.get('/simulator/*.html', streamSimHostHtml); app.get('/', streamAppHostHtml); app.get('/*.html', streamAppHostHtml); app.get('/simulator/app-host.js', function (request, response) { sendHostJsFile(response, 'app-host'); }); app.get('/simulator/sim-host.js', function (request, response) { sendHostJsFile(response, 'sim-host'); }); app.use(plugins.getRouter()); app.use('/simulator', cordovaServe.static(dirs.hostRoot['sim-host'])); app.use('/simulator/thirdparty', cordovaServe.static(dirs.thirdParty)); }
SimulationServer.prototype._prepareRoutes = function () { var app = this._cordovaServer.app; var streamSimHostHtml = this._streamSimHostHtml.bind(this), streamAppHostHtml = this._streamAppHostHtml.bind(this); app.get('/simulator/', streamSimHostHtml); app.get('/simulator/*.html', streamSimHostHtml); app.get('/', streamAppHostHtml); app.get('/*.html', streamAppHostHtml); app.get('/simulator/app-host.js', function (request, response) { this._sendHostJsFile(response, 'app-host'); }.bind(this)); app.get('/simulator/sim-host.js', function (request, response) { this._sendHostJsFile(response, 'sim-host'); }.bind(this)); app.use(this._project.getRouter()); app.use('/simulator', cordovaServe.static(this._hostRoot['sim-host'])); app.use('/simulator/thirdparty', cordovaServe.static(dirs.thirdParty)); };
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; }
Object.keys(plugins).forEach(function (plugin) { router.use('/simulator/plugin/' + plugin, cordovaServe.static(plugins[plugin])); });
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)); });
dirs.node_modules.forEach(function (dir) { app.use('/node_modules', cordovaServe.static(dir)); });