I'm trying to load a favicon into my Meteor project but I can't get it to work. I tried using this tutorial but when I put the mentioned reference in the of my HTML nothing happened. Also what do they mean by /public directory? I don't have a /public directory, should I just put my favicon.ico in the root directory?
The public directory doesn't exist by default - you just need to create it. Meteor uses the public directory in the root of your app to serve plain files rather than bundling them in the app. In order for a <link rel="icon"> tag to work, it needs to point to a file that exists in public. Note that the URL to the icon will not contain the path "public/" - files in public are served as if they were at the root of your web server.
A new Meteor app doesn't include any folders except the required .meteor directory. However, it will treat folders named public, private, client, server, and lib specially. You can also create more arbitrarily named directories. This affords you a lot of control over the exact structure of your app. Read about the Meteor directory structure in the Documentation:
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.
Create client/header.html: <head><link rel='icon' href='/favicon.ico'></head>
Put you favicon.ico into /public folder.
Start server, open your browser and see the result.
Related
I installed Modx through the built-in hosting download and there are generated files in the files index.html , mchost.php , index.php , config.core.php .
What to do with index.html ? I thought to rename it, but it turned out to be impossible inside the "files" tab -the field with the name is not clickable.
And what are the rest of the above files intended for?
index.php from MODX is critical and necessary, it's the entry point. config.core.php contains path to the MODX core, also necessary file out of the box. The rest do not apply to MODX, you can delete them.
I have a Vapor server API running in Heroku supporting an iOS app. I want to create a simple landing page for my app and I would like to host it in my existing Vapor server. How could I do that?
Vapor actually has a built-in middleware that makes this very easy. First, make sure you have a Public directory at the root of your Vapor project. Then you can put your static HTML page in there, along with any CSS and JS files it might rely on.
Next, you just need to add FileMiddleware to your application's middleware (docs):
let file = FileMiddleware(publicDirectory: app.directory.publicDirectory)
app.middleware.use(file)
Now you can access any of the files in your Public directory using their relative directory path as the path in the URL to your app. For example, if you have a static directory in your Public directory, and put a home.html file in it, you request the page by going to http://localhost:8080/static/home.html in your browser.
My ASP.NET MVC project's root directory contains some typical static files, like robots.txt, manifest.json, browserconfig.xml, etc. If I'm not mistaken, each of these examples I listed should be able to be served with no involvement from MVC via GET requests to the root directory (i.e. mysite.com/manifest.json — if that's not true, please let me know).
I know from this answer that I can configure this behavior per file type in the Web.config. My question is, what if there are other .json files in my root directory that I don't want to serve, like compilerconfig.json or bundleconfig.json (both files generated by IDE tools)? What's the best way for the application to be able to serve some files of type X, but not others?
You can always ignore them via routes:
routes.IgnoreRoute("{somefilename}.json");
Another alternative would be to move the files you don't want to be served to another folder and add a web.config file to it to manage what gets served (or doesn't).
I am sure there are other ways. Modules come to mind...
I have two websites in IIS under default web site. Lets say "Website1" page gives call to "webiste2" which return some content. Entry URL of website2 is http://domainname/websitename/controller/action this action return html(index.html). structure of website2 is as bellow.
Website
Folder(websitename)
........Folder A(folder_{id}(id is dynamically generated) is under folder A)
..............Folder_{id} --> this folder contains files with many extensions
........Index.html->this file has references to above folderA &subfolders files
........Web.config
Now i want to configure route such a way that that serve all types of files extensions for url like below.
websitename/folder A/filename.abc
websitename/Folder A/folder_1/filename.xy
websitename/folder A/Folder_1/filename.mp3
websitename/folder A/Folder_1/filename.png
There can be thousands folder under folder A. so the folder_1 value can be changed from folder_1 to folder_2, folder_3 .............. folder_1000 or as many folders.
I want generic rout to serve all dynamically generated folders and its files.
There are many files with different extensions under these dynamically created folder or we can see its as package of different files like .mp3, ,jpg, .swf, .js...
Please guide me to write rout to achieve above. Or you can provide links so that i can go through.
Simply, don't. Static files are supposed to be served directly by IIS. By default, in MVC, anything that has an extension (.*) is handled by IIS, and MVC is never even involved. If you've customized something, I'd recommend undoing that.
I have an existing Swagger.json file for a .NET WebApi site which I would like to integrate with my developer site (which is at a different url) running Swashbuckle.
Can I simply copy this swagger.json file to the mvc site (content or app_data folder and do this?)
If I can, where is the best place to put it.
How do I make this the default swagger file served up by the host?
The EnableSwagger method has two signatures, in one of them you can specify the route template to your files, so you can really serve it from wherever you want, just make sure your template matches the location of your json file. Take a look here: http://pastebin.com/MDfWNpUs