Public routes with parameters that do not require authentication do not work in express

Viewed 23
function jwt() {
  const { secret } = config;
  return expressJwt({ secret, algorithms: ["HS256"] }).unless({
    path: [
      // public routes that don't require authentication
      "/users/authenticate",
      "/users/create",

      "/series/getAllSeries",

      "/series/getByIdSeries/:id",
      "/series/getByStreamingService/:streamingService",
      "/series/getMonthSeries/:monthPosition/:streamingServiceName?",
    ],
  });
}

This routes only work with token. The exception for them to work publicly does not work

"/series/getByIdSeries/:id",
"/series/getByStreamingService/:streamingService",
"/series/getMonthSeries/:monthPosition/:streamingServiceName?",
0 Answers
Related