include simple javascript in nodejs

I am pretty new to Node.js and I went through a tutorial and set up my own server who responses to some requests with basic html.

var body = '<html>'+
            '<head>'+
            '<meta http-equiv="Content-Type" content="text/html; '+
            'charset=UTF-8">'+

            '</head>'+
            '<body>'+
            '<form action="/upload" method="post">'+
            '<textarea name="text" rows="20" cols="60"></textarea>'+
            '<input type="submit" value="Submit text">'+
            '</form>'+
            '</body>'+
            '</html>';


response.writeHead(200, {"Content-Type": "text/html"}); 
response.write(body); 

I have from a former project (basic html and JS) a javascript function which basically draws a table (calendar).

But how would I use it in Node.js? I dont really understand how I should build up the website?

Your previous code probably depended on accessing the DOM within a web browser. This is not available server side. So you can't generally just use the code you wrote for a client side environment in a server side js environment.

You could look at a library which allows server-side DOM manipulation. See: http://blog.marksoper.net/Server-side-DOM-manipulation-in-Nodejs-with-JSDOM-JQuery-and-Mustache-Templates-April-25-2011.html

If you don't want to write the HTML within your server-code I can strongly recommend Express.js having used it for a year now on my university final year project. http://expressjs.com/

Please note that Express usually expects you to use a templating language for your web-pages such as http://jade-lang.com/. However you don't need to use a templating language. (But they do provide some nice features such as passing JSON into the template)