Merge pull request #28 from directus/fix-static-admin

Fix admin app not returned from api
This commit is contained in:
Rijk van Zanten
2020-08-04 13:43:02 -04:00
committed by GitHub
2 changed files with 8 additions and 6 deletions

View File

@@ -55,15 +55,16 @@ if (env.CORS_ENABLED === 'true') {
);
}
const adminPath = require.resolve('@directus/app/dist/index.html');
app.get('/', (req, res) => res.redirect('/admin/'))
// the auth endpoints allow you to login/logout etc. It should ignore the authentication check
.use('/admin', express.static(path.join(__dirname, '../node_modules', '@directus/app/dist')))
.use('/admin/*', (req, res) =>
res.sendFile(path.join(__dirname, '../node_modules', '@directus/app/dist/index.html'))
)
.use('/admin', express.static(path.join(adminPath, '..')))
.use('/admin/*', (req, res) => {
res.sendFile(adminPath);
});
.use('/auth', authRouter)
app.use('/auth', authRouter)
.use(authenticate)

View File

@@ -4,6 +4,7 @@
"private": false,
"description": "Directus is an Open-Source Headless CMS & API for Managing Custom Databases",
"author": "Rijk van Zanten <rijk@rngr.org>",
"main": "dist/index.html",
"files": [
"dist",
"LICENSE",