mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 09:25:46 +00:00
change router matching "admin*" to "admin" & "admin/*" (#9128)
This commit is contained in:
parent
82380da065
commit
23d41fd18d
@ -81,16 +81,18 @@ module.exports = strapi => {
|
|||||||
if (!strapi.config.serveAdminPanel) return;
|
if (!strapi.config.serveAdminPanel) return;
|
||||||
|
|
||||||
const buildDir = path.resolve(strapi.dir, 'build');
|
const buildDir = path.resolve(strapi.dir, 'build');
|
||||||
|
const serveAdmin = ctx => {
|
||||||
|
ctx.type = 'html';
|
||||||
|
ctx.body = fs.createReadStream(path.join(buildDir + '/index.html'));
|
||||||
|
};
|
||||||
|
|
||||||
strapi.router.get(
|
strapi.router.get(
|
||||||
`${strapi.config.admin.path}/*`,
|
`${strapi.config.admin.path}/*`,
|
||||||
serveStatic(buildDir, { maxage: maxAge, defer: false, index: 'index.html' })
|
serveStatic(buildDir, { maxage: maxAge, defer: false, index: 'index.html' })
|
||||||
);
|
);
|
||||||
|
|
||||||
strapi.router.get(`${strapi.config.admin.path}*`, ctx => {
|
strapi.router.get(`${strapi.config.admin.path}`, serveAdmin);
|
||||||
ctx.type = 'html';
|
strapi.router.get(`${strapi.config.admin.path}/*`, serveAdmin);
|
||||||
ctx.body = fs.createReadStream(path.join(buildDir + '/index.html'));
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user