URL routing issues in IISnode Node js?
So here's my situation. This is my first time deploying a node app on Windows. So, I'm still extremely disappointed. The problem is with the URL routing. I wrote a very simple test application and wanted to test it on Windows after deploying it to an IIS node. But for some reason I keep getting this error "cannot GET (whatever I type)" This is what I have tried so far The web.config file -
<configuration>
<system.webServer>
<!-- indicates that the hello.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
</handlers>
<!-- use URL rewriting to redirect the entire branch of the URL namespace
to hello.js node.js application; for example, the following URLs will
all be handled by hello.js:
-->
<rewrite>
<rules>
<rule name="myapp">
<match url="myapp/*" />
<action type="Rewrite" url="hello.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
server file (hello.js) -
var express = require('express');
var app = express.createServer();
app.get('/myapp/foo', function (req, res) {
res.send('Hello from foo! [express sample]');
});
app.get('/myapp/bar', function (req, res) {
res.send('Hello from bar! [express sample]');
});
app.listen(process.env.PORT);
After that: this is what I get 1. http://localhost:4500/node/TestApp/myapp/foo
- "Unable to GET / node / TestApp / myapp / foo" 2. http://localhost:4500/node/TestApp/myapp
- "Unable to GET / node / TestApp / myapp"
Please help me with this mess.
source to share
No one has answered this question yet
See similar questions:
or similar: