Meteor : Access to my public/lib from server

妖精的绣舞 提交于 2019-12-25 16:25:15

问题


According to the Meteor Doc, the public fodler is accessible for both server and client. But, if I just need to use the HTML head elements to access it, how can I do it from server ?

I made a lib with very specific functions, and I'm tired of copy pasting them at the top of each of my server .js file.

Could anyone give me the tip ? I couldn't find out on google :/

Thanks you,

David


回答1:


You are making your life harder than necessary. Any folder that is not called client, server, private, or public is shared by the client and the server. Just put your shared .js files into any folder, say, /common, and they will be available (loaded) on both the client and the server.

The public folder is specifically for assets that are not loaded automatically by the server, but are instead served statically over HTTP, similar to the static functionality of express. It's the place for images and other assets you want on the client.



来源:https://stackoverflow.com/questions/32099887/meteor-access-to-my-public-lib-from-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!