'how to exclude API routes witch contain certain specific method in express jwt
app.use(`${api}/products`, productsRoutes);
app.use(`${api}/users`, usersRoutes);
i have routes i want that the api with GET method in products should be excluded in express jwt?
require("dotenv").config();
const api = process.env.API_URL
const jwt = require('express-jwt')
function authjwt() {
const secret = process.env.secret;
return jwt({ secret, algorithms: ['HS256'] }).unless({path:
['/api/v1/ products',
'/api/v1/ login',
]}));
module.exports = authjwt
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
