How to use the corvid-local-site.initSiteManager function in corvid-local-site

To help you get started, we’ve selected a few corvid-local-site 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 wix-incubator / corvid / packages / corvid-local-server / src / server.js View on Github external
await fs.move(siteSrcPath, snapshotFolder);
    await fs.emptyDir(siteSrcPath);
  }

  let localSite, editorServer, adminServer;

  const closeAll = () =>
    Promise.all([
      Promise.resolve(localSite && localSite.close()),
      Promise.resolve(editorServer && editorServer.close()),
      Promise.resolve(adminServer && adminServer.close())
    ]);

  try {
    localSite = await initLocalSiteManager(siteSrcPath, siteBackupPath);
    editorServer = await startSocketServer(DEFAULT_EDITOR_PORT, {
      allowedDomains: ["editor.wix.com"].concat(
        process.env.NODE_ENV === "test" ? ["localhost"] : []
      )
    });
    adminServer = await startSocketServer(DEFAULT_ADMIN_PORT);

    adminServer.io.use(adminTokenMiddleware(adminToken));

    initServerApi(localSite, adminServer, editorServer, !isEdit(options));

    logger.info(
      getMessage("Server_Listening_Log", {
        editorPort: editorServer.port,
        adminPort: adminServer.port
      })

corvid-local-site

MIT
Latest version published 3 years ago

Package Health Score

43 / 100
Full package analysis

Similar packages