In the app.js file, I have declared a app.locals property, say :
app.locals.targetUrl = 'hello world!!'
How can I access this property from custom javascript file. I have a custom js file containing routes and I need to refer the targetUrl property in the routes.js file.
Scenario
Say I have a restful api hosted at : http://localhost:55555/visit. Now In my routes file, I am appending depending upon the route, additional route suffixes e.g http://localhost:55555/visit/all or http://localhost:55555/visit/weekend etc. What I am looking for is a way to declare the base Url http://localhost:55555/visit once in app.js file and then be able to refer this as property in other routes file.
Aucun commentaire:
Enregistrer un commentaire