Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7052323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:22:11+00:00 2026-05-28T03:22:11+00:00

This question should be simple to answer for anyone with Node experience — unfortunately

  • 0

This question should be simple to answer for anyone with Node experience — unfortunately I am an extreme novice.

I am writing a web application for a board game that will use a server-client architecture to show real-time changes made to the board to all clients. The application uses Raphael to display the graphics.

I have created a server that successfully sends the HTML file to respond to any request, but the board does not display — only the raw HTML without any Javascript comes up. I think it is because I have programmed the server to always respond with the HTML file, and I can’t figure out how to send the Javascript files (client.js, raphael.js) to the client so that the page can load properly.

The relevant code is below. For now, I’m just trying to get the browser to draw one Raphael element so I can see that the client is properly getting the Javascript files it needs to load the page.

On the server side:

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

On the client side:

$(document).ready(function(){
    var R = Raphael("container", 1000, 700);
    this.R.path("M0,0l1000,700").attr({"stroke-width": "5"});
});

You can assume that the HTML file is formatted correctly and includes references to all the JS files — I’ve had the application working great without the server-client architecture for a while now. Also, I am using NowJS, so any solution that incorporates that framework would be welcome as well.

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:22:11+00:00Added an answer on May 28, 2026 at 3:22 am

    on your server side you are always returning index.html

    check out how the createServer method is used in this gist: https://gist.github.com/1245922

    it evaluates the extension to return a proper mime-type and then calls the stream file function to return the requested url/file from the fs.

    if you’re going to use this with nowjs then you’ll want to also use along the lines of:

        var everyone = nowjs.initialize(server);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be a simple question, but I haven't been able to find a
This should be a simple question, but I just can't recall the relevant API.
This should be a simple question, but I can't get it to work :(
This should be a simple question, but I just can't seem to figure it
This should be very simple question. There are many programming languages out there, compiled
I should know this but I expect it to be a simple answer... This
I feel like the answer to this question is really simple, but I really
I'd like to know the answer to this simple question. When I create an
OK, this feels like a question that should be easy to answer, but as
[EDIT] Hmm. Perhaps this question should be titled what is the default user-input dialog

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.