How to use the strapi-admin.watchAdmin function in strapi-admin

To help you get started, we’ve selected a few strapi-admin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi / lib / commands / watchAdmin.js View on Github external
const dir = process.cwd();
  const envConfigDir = path.join(dir, 'config', 'environments', 'development');
  const serverConfig = await loadConfigFile(envConfigDir, 'server.+(js|json)');

  const port = _.get(serverConfig, 'port', 1337);
  const host = _.get(serverConfig, 'host', 'localhost');
  const adminPort = _.get(serverConfig, 'admin.port', 8000);
  const adminHost = _.get(serverConfig, 'admin.host', 'localhost');
  const adminBackend = _.get(
    serverConfig,
    'admin.build.backend',
    `http://${host}:${port}`
  );
  const adminPath = _.get(serverConfig, 'admin.path', '/admin');

  strapiAdmin.watchAdmin({
    dir,
    port: adminPort,
    host: adminHost,
    options: {
      backend: adminBackend,
      publicPath: addSlash(adminPath),
    },
  });
};

strapi-admin

Strapi Admin

SEE LICENSE IN LICENSE
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis

Similar packages