mirror of
https://github.com/zoriya/flood.git
synced 2026-05-31 10:22:44 +00:00
server: servedPath is a URL path not file path
Thus we shall not use path.join(). Or NodeJS will helpfully convert the paths to Windows format if we are on Windows and as a result, breaks everything. Fixes:fee968525,8f4fb88ac
This commit is contained in:
+5
-5
@@ -33,8 +33,8 @@ app.use(cookieParser());
|
||||
|
||||
passportConfig(passport);
|
||||
|
||||
app.use(path.join(paths.servedPath, 'api'), apiRoutes);
|
||||
app.use(path.join(paths.servedPath, 'auth'), authRoutes);
|
||||
app.use(`${paths.servedPath}api`, apiRoutes);
|
||||
app.use(`${paths.servedPath}auth`, authRoutes);
|
||||
|
||||
// After routes, look for static assets.
|
||||
app.use(paths.servedPath, express.static(paths.appDist));
|
||||
@@ -42,15 +42,15 @@ app.use(paths.servedPath, express.static(paths.appDist));
|
||||
// Client app routes, serve index.html and client js will figure it out
|
||||
const html = fs.readFileSync(path.join(paths.appDist, 'index.html'), {encoding: 'utf8'});
|
||||
|
||||
app.get(path.join(paths.servedPath, 'login'), (_req, res) => {
|
||||
app.get(`${paths.servedPath}login`, (_req, res) => {
|
||||
res.send(html);
|
||||
});
|
||||
|
||||
app.get(path.join(paths.servedPath, 'register'), (_req, res) => {
|
||||
app.get(`${paths.servedPath}register`, (_req, res) => {
|
||||
res.send(html);
|
||||
});
|
||||
|
||||
app.get(path.join(paths.servedPath, 'overview'), (_req, res) => {
|
||||
app.get(`${paths.servedPath}overview`, (_req, res) => {
|
||||
res.send(html);
|
||||
});
|
||||
|
||||
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
declare const PATHS: {
|
||||
appBuild: string;
|
||||
appDist: string;
|
||||
appPublic: string;
|
||||
appHtml: string;
|
||||
appIndex: string;
|
||||
appPackageJson: string;
|
||||
appSrc: string;
|
||||
clientSrc: string;
|
||||
testsSetup: string;
|
||||
appNodeModules: string;
|
||||
servedPath: string;
|
||||
};
|
||||
|
||||
export = PATHS;
|
||||
@@ -30,7 +30,7 @@ const getAppDist = () => {
|
||||
return appDist;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
const PATHS = {
|
||||
appBuild: resolveApp('dist/assets'),
|
||||
appDist: getAppDist(),
|
||||
appPublic: resolveApp('client/src/public/'),
|
||||
@@ -43,3 +43,5 @@ module.exports = {
|
||||
appNodeModules: resolveApp('node_modules'),
|
||||
servedPath: ensureSlash(userConfig.baseURI || '/', true),
|
||||
};
|
||||
|
||||
module.exports = PATHS;
|
||||
|
||||
Reference in New Issue
Block a user