Home > Software engineering >  How can I allow all urls to public/
How can I allow all urls to public/

Time:03-28

I have some translation files, and I want to fetch this, but I dont know how can I allow the URL in nodejs express ?

This url I fetch

http://192.168.0.249:4000/public/locales/{{lng}}/translation.json

So how can I say allow all urls in public folder?

like

app.get('*/public') ....

CodePudding user response:

Use the express.static built-in middleware:

app.use(express.static('public'))

See: https://expressjs.com/en/starter/static-files.html

  • Related