score:0

Accepted answer
const jwt = require("express-jwt")
const auth = jwt({
  secret: process.env.JWT_SECRET,
  userProperty: 'payload'
});
app.use("/auth", authRoutes);
app.get("/api", auth, routes);



 // STATIC ASSETS WHEN PUSHED TO HEROKU
if (process.env.NODE_ENV === "production") {
  app.use(express.static("client/build"));
}
app.get("*", function(req, res) {
  res.sendFile(path.join(__dirname, "./client/public/index.html"));
});

Related Query

More Query from same tag