mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 08:19:07 +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;
|
||||
|
||||
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.config.admin.path}/*`,
|
||||
serveStatic(buildDir, { maxage: maxAge, defer: false, index: 'index.html' })
|
||||
);
|
||||
|
||||
strapi.router.get(`${strapi.config.admin.path}*`, ctx => {
|
||||
ctx.type = 'html';
|
||||
ctx.body = fs.createReadStream(path.join(buildDir + '/index.html'));
|
||||
});
|
||||
strapi.router.get(`${strapi.config.admin.path}`, serveAdmin);
|
||||
strapi.router.get(`${strapi.config.admin.path}/*`, serveAdmin);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user