express-admin icon indicating copy to clipboard operation
express-admin copied to clipboard

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

Open beilunyang opened this issue 8 years ago • 2 comments

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...

beilunyang avatar Apr 01 '17 19:04 beilunyang

+1

ThomasVictoria avatar Nov 19 '17 15:11 ThomasVictoria

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!

priya2429 avatar Oct 15 '18 07:10 priya2429