> Converting a text file to HTML to send to webpage? (Javascript)?

Converting a text file to HTML to send to webpage? (Javascript)?

Posted at: 2014-12-18 
It's not so much about converting as it is about wrapping. What my guess is they want you to do is to create a simple html document with a standard , then insert the file contents in it's .

You might also want to replace line breaks in the text file with
s.

It all comes down to String operations, basically:

if user requests about page:

send "..." + about.txt + ""

Note that node.js is a webserver written in JavaScript. So it sounds like this assignment is about writing JavaScript on the server side, not the client side. It's still possible to do this client side; you'd request the text file with AJAX, wrap it in HTML like above, then replace the document content with the result. However, this course is about how to use node.js, right?

We need the code of "node.js" to be able to answer. Repost or edit.

Hello, I don't know much about web programming but I have an assignment where I can't figure out how to do a part of it. I'm not sure if it matters but I'm using node.js for my server.

On the webpage the user is on, there are several links to different pages, each of which has a respective text file that's located on the server side that I must display, in HTML. How would I do that? I cannot store the html version of the text file either, I must create it with javascript each time a link is clicked and then give the html file to the client.

I know how to execute a javascript script when a hyperlink is clicked (i'm not sure if that is helpful).

Any help would be greatly appreciated!