# nodejs howto or wiki

## cwc

I'm  getting starting using nodejs I've installed it on my RaspPi.  Now I'd like to run it on Gentoo.

net-libs/nodejs-0.10.21

I'm running nginx on port 80.  So I'll go with 8000 or 8080 on nodejs.

I noticed the docs at /usr/share/doc/nodejs-0.10.21

I've search the web for a gentoo howto and did not find anything.

Please throw me a bone.

This is how node is started on my RPi

root@rpi:~# more /etc/init.d/nodejs.sh 

#!/bin/bash

NODE=/opt/node/bin/node

SERVER_JS_FILE=/home/pi/node/server.js

USER=pi

OUT=/home/pi/node/logs/nodejs.log

case "$1" in

start)

	echo "starting node: $NODE $SERVER_JS_FILE"

	sudo -u $USER $NODE $SERVER_JS_FILE > $OUT 2>$OUT &

	;;

stop)

	killall $NODE

	;;

*)

	echo "usage: $0 (start|stop)"

esac

exit 0

root@rpi:~#

----------

## cwc

https://github.com/chovy/node-startup

test.js

I'm going to give this a try with:

var sys = require("sys"),  

my_http = require("http");  

my_http.createServer(function(request,response){  

    sys.puts("I got kicked");  

    response.writeHeader(200, {"Content-Type": "text/plain"});  

    response.write("Hello World");  

    response.end();  

}).listen(8080);  

sys.puts("Server Running on 8080");  

as my test.js server

----------

