That would work if you want to send out that one file no matter what request comes in. I doubt that is what you want to do.
On Tue, Dec 25, 2012 at 7:40 AM, Rodrigo Fonseca <[email protected]> wrote: > Hey guys, > I'm doing a app 100% MVC with locomotive, i have one layout file that load > another files just to put the content, it's a small app, but very good > app... So, i want to know, the best way to load a html file, i google it and > found this solution: > > var http = require('http'), > fs = require('fs'); > > > fs.readFile('./index.html', function (err, html) { > if (err) { > throw err; > } > http.createServer(function(request, response) { > response.writeHeader(200, {"Content-Type": "text/html"}); > response.write(html); > response.end(); > }).listen(8000); > }); > > > What do you guys think?? > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
