html with swf file served by nodejs

308 views
Skip to first unread message

s j

unread,
Mar 22, 2012, 12:50:17 PM3/22/12
to nod...@googlegroups.com
Hello,

When i embed a swf file on an html file, and try to serve it through node js server, the swf file doesn't appear.  how can i fix this? 

(the callhttpservice.html file has the swf embedded on it, attached is the html page)

var fs = require('fs');
var server = require('http').createServer(function(req, response){
    fs.readFile(__dirname + '/callhttpservice.html', function (err, data) {
    response.writeHead(200, {'Content-Type':'text/html'});
    response.write(data); 
    response.end();
  });
});
server.listen(8080);


thanks for your help
callhttpservice.html

Nathan Rajlich

unread,
Mar 22, 2012, 3:02:12 PM3/22/12
to nod...@googlegroups.com
Your http server is currently hard-coded to serve the "callhttpservice.html" file, regardless of what url was actually requested. You should be looking into using a web framework like express (and the "static()" middleware) to serve static files properly for you.


--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

s j

unread,
Mar 22, 2012, 8:06:32 PM3/22/12
to nod...@googlegroups.com
First of all thanks for replying.  Can you direct me to a link that talks about using web frameworks and nodejs?

thanks again for your help

s j

unread,
Mar 22, 2012, 9:32:12 PM3/22/12
to nod...@googlegroups.com
Thanks for your help, everything is fine now

Gloria Josefina

unread,
Nov 10, 2014, 2:41:25 PM11/10/14
to nod...@googlegroups.com
Hi!

How did you fix this?
I´m having the same issue...

Thanxs!

Ryan Schmidt

unread,
Nov 10, 2014, 5:10:40 PM11/10/14
to nod...@googlegroups.com
Hi Gloria,

The message you quoted is 2.5 years old, but in the code shown, a server is being created that responds to *all requests* with a particular HTML page. It doesn't matter whether your request is for index.html or image.png or player.swf or movie.flv; the server that was shown will respond with the contents of the HTML page. That's probably not the desired behavior.

Maybe if you show us your code we can help you further.
Reply all
Reply to author
Forward
0 new messages