File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 11/node_modules
2- * .log
2+ * .log
3+ * idea /
Original file line number Diff line number Diff line change 11/*jslint node: true, nomen: true, unparam: true, es5: true */
22
33'use strict' ;
4- var express = require ( 'express' ) ,
5- shell = require ( 'shelljs' ) ,
6- url = require ( 'url' ) ,
4+ var express = require ( 'express' ) , // server dep
5+ shell = require ( 'shelljs' ) , // run shell commands. fixed win->linux cmds.
6+ url = require ( 'url' ) , // url routing.
77
88 port = 3000 ,
9- app = express ( ) ;
9+ app = express ( ) ; // express object init. used to build the server.
1010
11+ // get the default route.
1112app . get ( '/' , function ( req , res ) {
12- // '/?C will play a C note. ?Db plays a D flat note'
13- var note = url . parse ( req . url ) . query ;
1413
14+ // '/?C will play a C note. ?Db plays a D flat note'
15+ var note = url . parse ( req . url ) . query ; // do not regex to hell.
16+
17+ // new shell process: do note playoff udp style.
1518 shell . exec ( 'play -qn synth 2 pluck ' + note , { async :true } ) ;
19+
20+ // http response: I god you covered!
1621 res . status ( 200 ) . send ( 'Playing a note on the server!' ) ;
1722} ) ;
1823
19- app . listen ( port ) ;
20- console . log ( 'Synth started at http://localhost:' + port + '/' ) ;
24+ app . listen ( port ) ; // server init.
25+ console . log ( 'Synth started at http://localhost:' + port + '/' ) ;
You can’t perform that action at this time.
0 commit comments