Skip to content

Commit a586dc9

Browse files
committed
Add what is isomorphic javascript
1 parent a8a81e1 commit a586dc9

5 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
polar
2+
grizzly
3+
brown
4+
black
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
readFile: function (name, done) {
3+
// JSON API
4+
done(null, 'polar\ngrizzly')
5+
}
6+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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())
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
}

0 commit comments

Comments
 (0)