Reputation: 217
I'm using JWT to secure my app.
I created a folder named public
who store my img.
I want to get theses images from my app.
app.use("/public", express.static(__dirname + '/public'));
I try to add '/public/*
or just '/public'
to ignore this route but when i try to get my images i receive this message : {"message":"Invalid Token"}
How can do to JWT ignore all url with /public/
Thanks :)
Upvotes: 0
Views: 660
Reputation: 777
I'm assuming you validate the jwt using a middleware. I that case, just put the express.static middleware before the jwt middleware. That way, requests to '/public' will be handled by the express.static middleware, and won't reach the jwt middleware. (This of course means that these requests will not be validated by the jwt middleware.)
Upvotes: 1