File tree 3 files changed +31
-0
lines changed
3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Running a Node.js Server Forever
2
+
3
+ > [ http://youtu.be/P4mT5Tbx_KE ] ( http://youtu.be/P4mT5Tbx_KE )
4
+
5
+ Install [ io.js] ( https://iojs.org/en/index.html ) .
6
+
7
+ Then run ` node server.js ` to run the app.
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " nodejs-server" ,
3
+ "version" : " 0.1.0" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "start" : " budo index.js" ,
8
+ "test" : " node test.js"
9
+ },
10
+ "author" :
" Kyle Robinson Young <[email protected] > (http://dontkry.com)" ,
11
+ "license" : " MIT"
12
+ }
Original file line number Diff line number Diff line change
1
+ var http = require ( 'http' ) ;
2
+
3
+ var server = http . createServer ( function ( request , response ) {
4
+ if ( request . url === '/' ) {
5
+ response . setHeader ( 'Content-Type' , 'text/html' ) ;
6
+ response . end ( '<strong>obligatory bear!</strong>' ) ;
7
+ }
8
+ } ) ;
9
+
10
+ server . listen ( 8080 , function ( ) {
11
+ console . log ( 'Im listening on port 8080' ) ;
12
+ } ) ;
You can’t perform that action at this time.
0 commit comments