node.js - Sails looking in wrong directory -
I'm new to sails.js and node.js, so the question might be trivial, but I could not find the answer . I have my node on a web site in IIS. The JS app is deployed so that the app can be accessed on http://example.com/myapp/
http://myhost.com/myapp/app.js
While browsing, I get the HTTS status 404 (not found)
, because sail.jss looks like URL http://myhost.com/images/logo.png
, but this file is actually located at http://myhost.com/myapp/.tmp/public/images/logo .png
. This .tmp
folder is being created on the frame.
Can anyone put some light on it?
[edit]
I've added a rewrite rule in web.config and it works a lot better. But it only works when I put an application in the root of my web site (ACADD). If I put the application in the lower level (through entry), the added rule does not produce any effect.
Here is the web.config:
& lt; Handler & gt; & Lt; Add name = "iisnode" path = "app.js" verb = "*" module = "iisnode" /> & Lt; / Operators & gt; & Lt; Rewrite & gt; & Lt; Rules & gt; & Lt; Rule name = "Static content" & gt; & Lt; Action type = "rewrite" url = "assets {REQUEST_URI}" /> & Lt; / Rules & gt; & Lt; Rule name = "Dynamic content" & gt; & Lt; Conditions & gt; & Lt; Add input = "{REQUEST_FILENAME}" matchType = "IsFile" reject = "true" /> & Lt; / Status & gt; & Lt; Action type = "rewrite" url = "app.js" /> & Lt; / Rules & gt; & Lt; / Rules & gt; & Lt; / Rewrite & gt;
Well created by .tmp folder grunt You can reference grunts and work folders. Pipeline.js allows you to inject and select files / folders to spit out. You can easily change it to point to images and / JS folders.
Tasks / pipline.js
Module.exportscfiletox = CssFilesToInject.map (function (path) {return '.tmp / public /' + Path; // replace it}); Module.exports.jsFilesToInject = jsFilesToInject.map (function (path) {return '.tmp / public /' + path; // change it}};
I can think that there is one more solution, though I'm not sure that IIS is a rewrite rule. When a user visits site.com/images, point them at .tmp / public / images It is common to see that in Apache server.
Comments
Post a Comment