Reputation: 21
When I use Express framework,I put my ".html" files into folder views,then put ".js" and ".css" files into public.When I run my application,I can get the js and css,but I cann't get the articlecontent.html.The following is my page index.html.
<div class="nav-collapse">
<ul class="nav">
<li><a href="#">Home</a></li>
<li class="active"><a href="articlecontent.html" target="home">Content</a></li>
</ul>
<div id="container" class="container" style="height: inherit">
<iframe id="home" name="home" scrolling="no">content</iframe>
</div>
</div>
app.get("/",function index(req,res){
res.render("index.html");
});
Upvotes: 1
Views: 473
Reputation: 203304
The views
folder is typically meant to store template files; in other words, that folder contains the files that you send out using res.render()
.
If you want to serve a non-template HTML file, like your articlecontent.html
, you should place it in the public folder, so it will be served by the express.static
middleware (the same goes for your index.html
: if you don't require it to be rendered by a templating engine, you can move it to the public folder as well).
Upvotes: 1