File tree Expand file tree Collapse file tree
what-is-isomorphic-javascript Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # What is Isomorphic JavaScript?
2+
3+ > [ http://youtu.be/Q6TAMCH0lL0 ] ( http://youtu.be/Q6TAMCH0lL0 )
4+
5+ Install [ io.js] ( https://iojs.org/en/index.html ) .
6+
7+ Within this folder run the terminal command ` npm install ` to install the
8+ ` devDependencies ` .
9+
10+ Run ` node index.js ` to run the script through the server side.
11+
12+ Then run ` npm start ` to start up a development server on ` http://localhost:9966 ` and run the scripts through the client side.
Original file line number Diff line number Diff line change 1+ polar
2+ grizzly
3+ brown
4+ black
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ readFile : function ( name , done ) {
3+ // JSON API
4+ done ( null , 'polar\ngrizzly' )
5+ }
6+ }
Original file line number Diff line number Diff line change 1+ // var fs = require('fs')
2+ // function upperCaseRead (filename, done) {
3+ // fs.readFile(filename, function (err, file) {
4+ // done(null, file.toString().toUpperCase())
5+ // })
6+ // }
7+ //
8+ // upperCaseRead('bears.txt', function (err, file) {
9+ // console.log(file)
10+ // })
11+
12+ var document = require ( 'global/document' )
13+
14+ var ul = document . createElement ( 'ul' )
15+ var bears = [ 'grizzly' , 'polar' ]
16+
17+ bears . forEach ( function ( bear ) {
18+ var li = document . createElement ( 'li' )
19+ li . innerText = bear
20+ ul . appendChild ( li )
21+ } )
22+
23+ //document.body.appendChild(ul)
24+
25+ console . log ( ul . toString ( ) )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " what-is-isomorphic-javascript" ,
3+ "version" : " 0.1.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "start" : " budo index.js --live -- --require ./fake-fs.js:fs"
8+ },
9+ "author" : " Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)" ,
10+ "license" : " MIT" ,
11+ "devDependencies" : {
12+ "browserify" : " ^10.2.1" ,
13+ "budo" : " ^4.0.0"
14+ },
15+ "dependencies" : {
16+ "global" : " ^4.3.0"
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments