simov / express-admin

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

can't get currect static files when embedding express-admin #123

Open beilunyang opened 7 years ago

beilunyang commented 7 years ago

I can't get current static files when embedding express-admin to my express app. this is my config.json and app.js

// config.json
"app": {
        "root": "."
 }
// app.js
const express = require('express');
const bodyParser = require('body-parser');
const xAdmin = require('express-admin');
const xAdminConfig = require('./express-admin-config/config');
const xAdminSettings = require('./express-admin-config/settings');
const xAdminCustom = require('./express-admin-config/custom');
const xAdminUsers = require('./express-admin-config/users');
const api = require('./routes/api');

const config = {
  dpath: './express-admin-config/',
  config: xAdminConfig,
  settings: xAdminSettings,
  custom: xAdminCustom,
  users: xAdminUsers,
};

xAdmin.init(config, (err, admin) => {
  if (err) return console.error(err);
  const app = express();
  app.use('/admin', admin);
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(bodyParser.json());
  app.use('/api/v1', api);
  return app.listen(3000, () => console.log('server is listening:3000'));
});

i can get currect static files when i access to mainview , but when i access to editview and newview, i can't get currect static files.



the content of .js file and .css file is html code... hope you can understand what i mean, thank you...

ThomasVictoria commented 6 years ago

+1

priya2429 commented 5 years ago

I'm experiencing the same, Did you manage to solve it some way, If so, please share with us, So it will be helpful for many. Thanks!