cors
cors copied to clipboard
Use cors on static files only?
I have the following line in my code:
app.use(express.static("public", { maxAge: "1h" }));
Ideally, I'd only allow cors on this route. What would be a good way to do that?
As per the express documentation:
app.use([path,] callback [, callback...])
app.use(cors(options), express.static("public", { maxAge: "1h" }));