simov / express-admin

MySQL, MariaDB, PostgreSQL, SQLite admin for Node.js
MIT License
1.17k stars 223 forks source link

Fixes static files path resolution. #101

Closed cperryk closed 8 years ago

cperryk commented 8 years ago

Hey — I noticed that when embedding express-admin with the code shown under the "embedding" section of the documentation, none of the static assets are found. They all redirect to /admin/login. That's because of this line of code in express-admin/app.js:

.use(serveStatic(path.join(__dirname, 'node_modules/express-admin-static')));

This is looking for static assets in node_modules/express-admin/node_modules/express-admin-static. But express-admin-static isn't there; it's installed in the same node_modules that contains express-admin itself. Since npm version 3, npm installs sub-dependencies in a flat way.

Here's my suggestion on how to fix this. In this PR, I use the npm package get-installed-path to locate the real path to express-admin-static.

simov commented 8 years ago

@cperryk take a look at https://github.com/simov/express-admin/commit/9d9cebb5c1779a61e49b16dd837e9ed12ef08600 I'll publish the fix on NPM shortly. Let me know if you have any comments.

simov commented 8 years ago

Version 1.2.8 is published.