Meteor : Access to my public/lib from server - meteor

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

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.

Related

ASP.Net Accessing Server Filesystem

I am having trouble accessing information on the server my website it on. As the website was originally programmed with VB.Net, I cannot change the language without having to completely reboot the website. The way the website and server are configured, I can only use ASP.Net and VB.Net.
I am needing to add a section where they can create folders, edit folder names, and upload pictures and text documents on the server through the public website. I tried using parts of the FileIO, Server, and Http that should have worked, but none of them did. Most of my research is about local files and text documents.
I have not been able to find any information that works. Can someone help me? Thank you.
Firstly, creating a virtual directory in ISS mapped to somewhere on your disk would be a good start. This way you have a separate folder for user data in a folder with write access (make sure IIS has write access to the folder!), and the folder is not affected by website deployments.
Secondly, you might need to resolve absolute path for most of the System.IO.File calls. See How to convert a relative path to an absolute path in a Windows application?, just you will need to convert this code to VB.

ASP.NET How to open a folder at server side?

I'm trying to open folder location from code behind
Process prc = new Process();
prc.StartInfo.UseShellExecute = true;
prc.StartInfo.FileName = #"\\Shared\FolderName\test";
prc.Start();
After that I got it I couldn't achieve by using Shell32 class or Process.Start on server side as well as adding link to path cant be used because of the security problem so how can achieve this problem ?
Thanks for your help
That's right, you won't be able to launch an external process in a web application (and with good reason!). I think you need to reconsider what it is you're trying to achieve... perhaps some more information will help us give you a better solution?
A web application hosted on server can not access external file and folders on the system. This is due to security reasons. However if you want to access some specific folder, you need to create virtual directory and give path to that folder to the virtual directory. Now you can access that folder using virtual directory.
I worked on such scenario where I needed to upload file using one application (admin app) and needed to show on an other application (client app). So it works fine if you want to access outside resources.

meteor private subdirectory

I was recently made aware of meteor private subdirectories. According to the docs: "The private subdirectory is the place for any files that should be accessible to server code but not served to the client, like private data files." I am a newbie at web development in general, so my question is what is the advantage of having these files within the private subdirectory vs. just in the server subdirectory itself? Is the server subdirectory not private - e.g. I have some email templates defined and my email login information is set up in a startup function in the server subdirectory, are these somehow exposed to the client? Any clarification would be very helpful, thanks!
No, your code in the server directory is safe. The difference is on how you use/access those files. Files in your server directory will be loaded/executed on the server, and they would also be difficult to access using the filesystem in the running app. Content of files in your private directory is available as an asset. See http://docs.meteor.com/#assets for full details.
The thing to note is that your server code does not execute in your server directory, but will have a current working directory that is a temporary build directory within .meteor. So if you wanted to use, say, the fs node package to read files in your server directory, you'd first need to find it. Moreover, any new file or a file change in your server directory will trigger meteor to restart your app. There are scenarios where you don't want that. So private gives you a place to handle files that do not affect the execution of the app.
Another way to think about it is that private is for the server what public is for the client.

Get Static referenced files with http request in meteor

This can be a silly question but I have had some issues with it. I am trying to implement jwplayer with meteor. Jwplayer will try to get a file based off the url you suggest. So I tried to place a file in localhost:3000/test.mp3. When I tried to hit that url I get just the default site. This would work if I used tomcat. Is there something I can do to get the files relative to meteor directory?
Thanks for your help.
In the /public directory, per the docs:
Lastly, the Meteor server will serve any files under the public directory, just like in a Rails or Django project. This is the place for images, favicon.ico, robots.txt, and anything else.
Meteor hasn't yet implemented server side routing and all directories are ultimately flattened. So for the time being, you can access your file at http://localhost:3000/test.mp3, but that may change in the future.

Force download audio file in ASP.NET using public path

does any one knows how to force the downloa of a file with the "...Save As" window using a public path, for example:
www.domain.com/audio/myfile.mp3
I have found a lot of examples but using a virtual path and noth a public path.
Thank you
You might be able to do some IIS url rewrite voodoo to pull this off. You could easily do some URL routing to make it look like you are downloading from /audio/file.mp3 but are actually pulling the file through a special handler.
But if you are just serving a file with a mimetype there isn't a whole lot you could do -- the client really controls how they handle files when not instructed and you've got no instructions on how to handle it if you are just posting files for download in a directly accessible manner.

Resources