I was trying to run a simple client side javascript code in my Node JS server. But failed. My index.js file looks like below
response.writeHead(200, { 'Content-Type': 'text/html'});
response.write('Helloooo Wolrd!!');
response.end();
Now how do I put below ordinary javascript snippet in to above index.js page to run on Node JS(I want to know "Node way" of doing it AKA "Node Best Practise"),
<script type="text/javascript">
var ns = 1;
if (ns == 1){
alert('Oh..Node what have you done?');
}else{
alert('Node is not bad after all');
}
</script>
What I'm Really doing: What I 'm really building is building a web page that runs on Node Js which will capture Gyro values like Device Orientation and Device Motion through a javascript of my iPhone and send it back to the web server. I can simply do this in Apache stack. But its too havey and slow. Thats why I want Node JS