fix(mobile): move baseUrl config to experiments.baseUrl and filter static assets in express wildcard handler
This commit is contained in:
@@ -49,6 +49,14 @@ app.get('/{*path}', (req, res, next) => {
|
|||||||
if (req.path.startsWith(apiRoot)) return next();
|
if (req.path.startsWith(apiRoot)) return next();
|
||||||
if (req.path === '/_cron/tick') return next();
|
if (req.path === '/_cron/tick') return next();
|
||||||
|
|
||||||
|
// Do not serve HTML for static assets or requests that do not accept HTML
|
||||||
|
const isAsset = /\.[a-z0-9]{2,4}$/i.test(req.path);
|
||||||
|
const acceptsHtml = req.headers.accept?.includes('text/html');
|
||||||
|
if (isAsset || !acceptsHtml) {
|
||||||
|
res.status(404).json({ success: false, error: 'Not found' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (req.path.startsWith('/mobile')) {
|
if (req.path.startsWith('/mobile')) {
|
||||||
res.sendFile(path.join(publicDir, 'mobile/index.html'), (err) => {
|
res.sendFile(path.join(publicDir, 'mobile/index.html'), (err) => {
|
||||||
if (err) next();
|
if (err) next();
|
||||||
|
|||||||
@@ -23,8 +23,7 @@
|
|||||||
"web": {
|
"web": {
|
||||||
"bundler": "metro",
|
"bundler": "metro",
|
||||||
"output": "single",
|
"output": "single",
|
||||||
"favicon": "./assets/images/favicon.png",
|
"favicon": "./assets/images/favicon.png"
|
||||||
"baseUrl": "/mobile"
|
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"expo-router",
|
"expo-router",
|
||||||
@@ -32,7 +31,8 @@
|
|||||||
"expo-web-browser"
|
"expo-web-browser"
|
||||||
],
|
],
|
||||||
"experiments": {
|
"experiments": {
|
||||||
"typedRoutes": true
|
"typedRoutes": true,
|
||||||
|
"baseUrl": "/mobile"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user