--
logging sample logging
Node.js applications hosted in IIS capture stdout and stderr (console.log) and make the output available over HTTP.
visit the node.js endpoint at hello.js
- output from console.log (or any stdout or stderr output) from a node.js application is captured, stored in a file on disk, and available through HTTP
- By default, given a node.js application at http://localhost/node/logging/hello.js, the logs are available at http://localhost/node/logging/iisnode/.
- Check the configuration sample to customize the logging behavior.
visit the logs at logs (only available after you first visit the endpoint)
debug node.js endpoint at hello.js/debug (requires WebKit enabled browser)
code
var http = require('http'); http.createServer(function (req, res) { console.log('A new request arrived with HTTP headers: ' + JSON.stringify(req.headers)); res.writeHead(200, { 'Content-Type': 'text/html' }); res.end('Hello, world! [logging sample]'); }).listen(process.env.PORT); console.log('Application has started at location ' + process.env.PORT);web.config
<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> </system.webServer> </configuration>
--