text: const express = require("express");
  const morgan = require("morgan");
  const helmet = require("helmet");
  const jwt = require("express-jwt");
  const jwksRsa = require("jwks-rsa");
  const { join } = require("path");
  const authConfig = require("./src/auth_config.json");
  
  const app = express();
  
  const port = 3001;//process.env.NODE_ENV === "production" ? 3000 : 3001;
  
  if (!authConfig.domain || !authConfig.audience) {
    throw new Error(
      "Please make sure that auth_config.json is in place and populated"
    );
  }
  
  app.use(morgan("dev"));
  app.use(helmet());
  app.use(express.static(join(__dirname, "build")));
  
  const checkJwt = jwt({
    secret: jwksRsa.expressJwtSecret({
      cache: true,
      rateLimit: true,
      jwksRequestsPerMinute: 5,
      jwksUri: `https://${authConfig.domain}/.well-known/jwks.json`
    }),
  
    audience: authConfig.audience,
    issuer: `https://${authConfig.domain}/`,
    algorithm: ["RS256"]
  });
  
  app.get("/api/external", checkJwt, (req, res) => {
    res.send({
      msg: "Your access token was successfully validated!"
    });
  });
  
  app.use((_, res) => {
    res.sendFile(join(__dirname, "build", "index.html"));
  });
  
  app.listen(port, () => console.log(`Server listening on port ${port}`));
  