From ad4e3e4fb58d19fa14b4b1c9d89bb3885a08fcde Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Tue, 4 Aug 2020 13:42:06 -0400 Subject: [PATCH] Fix admin app not returned from api --- api/src/app.ts | 13 +++++++------ app/package.json | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/src/app.ts b/api/src/app.ts index 69c4c0c831..a320196df1 100644 --- a/api/src/app.ts +++ b/api/src/app.ts @@ -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) diff --git a/app/package.json b/app/package.json index 08d2cacfaa..5f075510ea 100644 --- a/app/package.json +++ b/app/package.json @@ -4,6 +4,7 @@ "private": false, "description": "Directus is an Open-Source Headless CMS & API for Managing Custom Databases", "author": "Rijk van Zanten ", + "main": "dist/index.html", "files": [ "dist", "LICENSE",