How to use the next-server/dist/server/utils.isInternalUrl function in next-server

To help you get started, we’ve selected a few next-server 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 toomuchdesign / next-react-router / server.js View on Github external
server.get('/*', async (req, res, next) => {
    try {
      // @NOTE code duplication from here
      const pathName = req.originalUrl;
      if (isInternalUrl(req.url)) {
        return app.handleRequest(req, res, req.originalUrl)

      if (isBlockedPage(pathName)) {
        return app.render404(req, res, req.originalUrl)

      // Provide react-router static router with a context object
      req.locals = {};
      req.locals.context = {};
      const html = await app.renderToHTML(req, res, '/', {});

      // Handle client redirects
      const context = req.locals.context;
      if (context.url) {