You can use
readFileSync<http://nodejs.org/api/fs.html#fs_fs_readfilesync_filename_encoding>
var http = require('http'),
fs = require('fs');
var html = fs.readFileSync('./index.html');
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(html);
response.end();
}).listen(8000);
2012/12/26 Rodrigo Fonseca <[email protected]>
> Pedro,
> Yes, it's done during app initialization, how can i do this?? I´m
> begginer with node, can you explain more details about it?
>
> Mark,
> Ii want to do what Pedro said.
>
> cheers.
>
>
>> --
> 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