Commit abbde776 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+7 −0
Changes for Overview of the Node js Ecosystem - Working Files/Chapter 1/No Work Files.rtf: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\fs24 \cf0 No work files for this lesson...}
 No newline at end of file
+13 −0
Changes for Overview of the Node js Ecosystem - Working Files/Chapter 2/log.js: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
var fs = require("fs");

readFileIPromiseImNonBlocking("log.js", "utf8", function(error, data){
	console.log(data);
});

console.log("other code " + (4+5))


function readFileIPromiseImNonBlocking(fileName, encoding, callback){
	var data = fs.readFileSync(fileName, encoding);
	callback(encoding, data);
}
 No newline at end of file
+7 −0
Changes for Overview of the Node js Ecosystem - Working Files/Chapter 2/timers.js: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
console.log("start of program");

setInterval(function(){
	console.log("5 seconds later");
},1000);

console.log("end of program");
 No newline at end of file
+16 −0
Changes for Overview of the Node js Ecosystem - Working Files/Chapter 2/webserver.js: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
const http = require('http');

const hostname = '127.0.0.1';
const port = 1337;

var userCounter = 0;

http.createServer((req, res) => {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  
  userCounter++;

  res.end('Hello World, you are user: \n' + userCounter);
}).listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});
 No newline at end of file
+16 −0
Changes for Overview of the Node js Ecosystem - Working Files/Chapter 3/parser.js: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line

function htmlQuotes(quotes){

  return quotes.split(/\n/)
    .map(function(line){
      var columns = line.split(/,/);
      var company = columns[0].replace(/\"/g,"")
      var price = columns[2]
      return `${company}: ${price}<br/>`
    });

}

var local = "local";

module.exports = htmlQuotes;
 No newline at end of file
Loading