diff --git a/Chapter01/debugging-with-devtools/app/future.js b/Chapter01/debugging-with-devtools/app/future.js deleted file mode 100644 index 152866a..0000000 --- a/Chapter01/debugging-with-devtools/app/future.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = (age, gap) => { - return `In ${gap} years you will be ${Number(age) + gap}
` -} \ No newline at end of file diff --git a/Chapter01/debugging-with-devtools/app/index.js b/Chapter01/debugging-with-devtools/app/index.js deleted file mode 100644 index c90b47a..0000000 --- a/Chapter01/debugging-with-devtools/app/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const express = require('express') -const app = express() -const past = require('./past') -const future = require('./future') - -app.get('/:age', (req, res) => { - res.send(past(req.params.age, 10) + future(req.params.future, 10)) -}) - -app.listen(3000) \ No newline at end of file diff --git a/Chapter01/debugging-with-devtools/app/package.json b/Chapter01/debugging-with-devtools/app/package.json deleted file mode 100644 index 8711bc5..0000000 --- a/Chapter01/debugging-with-devtools/app/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - } -} diff --git a/Chapter01/debugging-with-devtools/app/past.js b/Chapter01/debugging-with-devtools/app/past.js deleted file mode 100644 index f0ea5c7..0000000 --- a/Chapter01/debugging-with-devtools/app/past.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = (age, gap) => { - return `${gap} years ago you were ${Number(age) - gap}
` -} \ No newline at end of file diff --git a/Chapter01/enabling-core-debug-logs/app/index.js b/Chapter01/enabling-core-debug-logs/app/index.js deleted file mode 100644 index c493e89..0000000 --- a/Chapter01/enabling-core-debug-logs/app/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const express = require('express') -const app = express() - -app.get('/', (req, res) => res.send('hey')) - - -setTimeout(function myTimeout() { - console.log('I waited for you.') -}, 100) - -app.listen(3000) diff --git a/Chapter01/enabling-core-debug-logs/app/package.json b/Chapter01/enabling-core-debug-logs/app/package.json deleted file mode 100644 index 2619e97..0000000 --- a/Chapter01/enabling-core-debug-logs/app/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.0" - } -} diff --git a/Chapter01/enabling-core-debug-logs/instrumented-app/index.js b/Chapter01/enabling-core-debug-logs/instrumented-app/index.js deleted file mode 100644 index 5c5fa9e..0000000 --- a/Chapter01/enabling-core-debug-logs/instrumented-app/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const util = require('util') -const express = require('express') -const debug = util.debuglog('my-app') -const app = express() - -app.get('/', (req, res) => { - debug('incoming request on /', req.route) - res.send('hey') -}) - -setTimeout(function myTimeout() { - debug('timeout complete') - console.log('I waited for you.') -}, 100) - -app.listen(3000) diff --git a/Chapter01/enabling-core-debug-logs/instrumented-app/package.json b/Chapter01/enabling-core-debug-logs/instrumented-app/package.json deleted file mode 100644 index 2619e97..0000000 --- a/Chapter01/enabling-core-debug-logs/instrumented-app/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.0" - } -} diff --git a/Chapter01/enabling-debug-logs/app/index.js b/Chapter01/enabling-debug-logs/app/index.js deleted file mode 100644 index 09f7dc5..0000000 --- a/Chapter01/enabling-debug-logs/app/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const express = require('express') -const app = express() -const stylus = require('stylus') - -app.get('/some.css', (req, res) => { - const css = stylus(` - body - color:black - `).render() - res.send(css) -}) - -app.listen(3000) diff --git a/Chapter01/enabling-debug-logs/app/package.json b/Chapter01/enabling-debug-logs/app/package.json deleted file mode 100644 index 12edb60..0000000 --- a/Chapter01/enabling-debug-logs/app/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.0", - "stylus": "^0.54.5" - } -} diff --git a/Chapter01/enabling-debug-logs/instrumented-app/index.js b/Chapter01/enabling-debug-logs/instrumented-app/index.js deleted file mode 100644 index 0d2748c..0000000 --- a/Chapter01/enabling-debug-logs/instrumented-app/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const express = require('express') -const app = express() -const stylus = require('stylus') -const debug = require('debug')('my-app') - -app.get('/some.css', (req, res) => { - debug('css requested') - const css = stylus(` - body - color:black - `).render() - res.send(css) -}) - -app.listen(3000) diff --git a/Chapter01/enabling-debug-logs/instrumented-app/package.json b/Chapter01/enabling-debug-logs/instrumented-app/package.json deleted file mode 100644 index 14e3518..0000000 --- a/Chapter01/enabling-debug-logs/instrumented-app/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "debug": "^2.6.2", - "express": "^4.15.0", - "stylus": "^0.54.5" - } -} diff --git a/Chapter01/enabling-debug-logs/logging-app/index.js b/Chapter01/enabling-debug-logs/logging-app/index.js deleted file mode 100644 index 09f7dc5..0000000 --- a/Chapter01/enabling-debug-logs/logging-app/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const express = require('express') -const app = express() -const stylus = require('stylus') - -app.get('/some.css', (req, res) => { - const css = stylus(` - body - color:black - `).render() - res.send(css) -}) - -app.listen(3000) diff --git a/Chapter01/enabling-debug-logs/logging-app/package.json b/Chapter01/enabling-debug-logs/logging-app/package.json deleted file mode 100644 index 3f173b4..0000000 --- a/Chapter01/enabling-debug-logs/logging-app/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "dev": "node index.js", - "prod": "node -r pino-debug index.js" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.0", - "pino-debug": "^1.0.3", - "stylus": "^0.54.5" - } -} diff --git a/Chapter01/enabling-debug-logs/logging-app/package.json.save b/Chapter01/enabling-debug-logs/logging-app/package.json.save deleted file mode 100644 index 1c20e7f..0000000 --- a/Chapter01/enabling-debug-logs/logging-app/package.json.save +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "node - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.0", - "pino-debug": "^1.0.2", - "stylus": "^0.54.5" - } -} diff --git a/Chapter01/enhancing-stack-traces/app/content.js b/Chapter01/enhancing-stack-traces/app/content.js deleted file mode 100644 index 82ac395..0000000 --- a/Chapter01/enhancing-stack-traces/app/content.js +++ /dev/null @@ -1,5 +0,0 @@ -function content (opts, c = 20) { - return --c ? content(opts, c) : opts.ohoh -} - -module.exports = content \ No newline at end of file diff --git a/Chapter01/enhancing-stack-traces/app/index.js b/Chapter01/enhancing-stack-traces/app/index.js deleted file mode 100644 index 3ec13c3..0000000 --- a/Chapter01/enhancing-stack-traces/app/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const express = require('express') -const routes = require('./routes') -const app = express() - -app.use(routes) - -app.listen(3000) diff --git a/Chapter01/enhancing-stack-traces/app/package.json b/Chapter01/enhancing-stack-traces/app/package.json deleted file mode 100644 index 8711bc5..0000000 --- a/Chapter01/enhancing-stack-traces/app/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - } -} diff --git a/Chapter01/enhancing-stack-traces/app/routes.js b/Chapter01/enhancing-stack-traces/app/routes.js deleted file mode 100644 index 67e4e04..0000000 --- a/Chapter01/enhancing-stack-traces/app/routes.js +++ /dev/null @@ -1,9 +0,0 @@ -const content = require('./content') -const {Router} = require('express') -const router = new Router() - -router.get('/', (req, res) => { - res.send(content()) -}) - -module.exports = router \ No newline at end of file diff --git a/Chapter01/enhancing-stack-traces/async-stack-app/content.js b/Chapter01/enhancing-stack-traces/async-stack-app/content.js deleted file mode 100644 index 894e411..0000000 --- a/Chapter01/enhancing-stack-traces/async-stack-app/content.js +++ /dev/null @@ -1,9 +0,0 @@ -function content (opts, c = 20) { - function produce (cb) { - if (--c) setTimeout(produce, 10, cb) - cb(null, opts.ohoh) - } - return produce -} - -module.exports = content diff --git a/Chapter01/enhancing-stack-traces/async-stack-app/index.js b/Chapter01/enhancing-stack-traces/async-stack-app/index.js deleted file mode 100644 index 022e289..0000000 --- a/Chapter01/enhancing-stack-traces/async-stack-app/index.js +++ /dev/null @@ -1,10 +0,0 @@ -if (process.env.NODE_ENV !== 'production') { - require('longjohn') -} -const express = require('express') -const routes = require('./routes') -const app = express() - -app.use(routes) - -app.listen(3000) diff --git a/Chapter01/enhancing-stack-traces/async-stack-app/package.json b/Chapter01/enhancing-stack-traces/async-stack-app/package.json deleted file mode 100644 index e8f54a1..0000000 --- a/Chapter01/enhancing-stack-traces/async-stack-app/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - }, - "devDependencies": { - "longjohn": "^0.2.12" - } -} diff --git a/Chapter01/enhancing-stack-traces/async-stack-app/routes.js b/Chapter01/enhancing-stack-traces/async-stack-app/routes.js deleted file mode 100644 index ba48221..0000000 --- a/Chapter01/enhancing-stack-traces/async-stack-app/routes.js +++ /dev/null @@ -1,15 +0,0 @@ -const content = require('./content') -const {Router} = require('express') -const router = new Router() - -router.get('/', (req, res) => { - content()((err, html) => { - if (err) { - res.send(500) - return - } - res.send(html) - }) -}) - -module.exports = router \ No newline at end of file diff --git a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/content.js b/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/content.js deleted file mode 100644 index 82ac395..0000000 --- a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/content.js +++ /dev/null @@ -1,5 +0,0 @@ -function content (opts, c = 20) { - return --c ? content(opts, c) : opts.ohoh -} - -module.exports = content \ No newline at end of file diff --git a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/index.js b/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/index.js deleted file mode 100644 index e506871..0000000 --- a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/index.js +++ /dev/null @@ -1,10 +0,0 @@ -if (process.env.NODE_ENV !== 'production') { - Error.stackTraceLimit = Infinity -} -const express = require('express') -const routes = require('./routes') -const app = express() - -app.use(routes) - -app.listen(3000) diff --git a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/package.json b/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/package.json deleted file mode 100644 index 8711bc5..0000000 --- a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - } -} diff --git a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/routes.js b/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/routes.js deleted file mode 100644 index 67e4e04..0000000 --- a/Chapter01/enhancing-stack-traces/infinite-stack-in-dev-app/routes.js +++ /dev/null @@ -1,9 +0,0 @@ -const content = require('./content') -const {Router} = require('express') -const router = new Router() - -router.get('/', (req, res) => { - res.send(content()) -}) - -module.exports = router \ No newline at end of file diff --git a/Chapter01/enhancing-stack-traces/pretty-stack-app/content.js b/Chapter01/enhancing-stack-traces/pretty-stack-app/content.js deleted file mode 100644 index 74b887b..0000000 --- a/Chapter01/enhancing-stack-traces/pretty-stack-app/content.js +++ /dev/null @@ -1,5 +0,0 @@ -function content (opts, c = 20) { - return --c ? content(opts, c) : opts.ohoh -} - -module.exports = content diff --git a/Chapter01/enhancing-stack-traces/pretty-stack-app/index.js b/Chapter01/enhancing-stack-traces/pretty-stack-app/index.js deleted file mode 100644 index 730bf2f..0000000 --- a/Chapter01/enhancing-stack-traces/pretty-stack-app/index.js +++ /dev/null @@ -1,8 +0,0 @@ -require('cute-stack')() -const express = require('express') -const routes = require('./routes') -const app = express() - -app.use(routes) - -app.listen(3000) diff --git a/Chapter01/enhancing-stack-traces/pretty-stack-app/package.json b/Chapter01/enhancing-stack-traces/pretty-stack-app/package.json deleted file mode 100644 index 8d1b318..0000000 --- a/Chapter01/enhancing-stack-traces/pretty-stack-app/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "cute-stack": "^1.4.3", - "express": "^4.15.2" - }, - "devDependencies": {} -} diff --git a/Chapter01/enhancing-stack-traces/pretty-stack-app/routes.js b/Chapter01/enhancing-stack-traces/pretty-stack-app/routes.js deleted file mode 100644 index 67e4e04..0000000 --- a/Chapter01/enhancing-stack-traces/pretty-stack-app/routes.js +++ /dev/null @@ -1,9 +0,0 @@ -const content = require('./content') -const {Router} = require('express') -const router = new Router() - -router.get('/', (req, res) => { - res.send(content()) -}) - -module.exports = router \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/client.js b/Chapter03/communicating-over-sockets/client.js deleted file mode 100644 index 08c9b8f..0000000 --- a/Chapter03/communicating-over-sockets/client.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -const net = require('net') - -const socket = net.connect(1337, 'localhost') -const name = process.argv[2] || 'Dave' - -socket.write(name) - -socket.on('data', (data) => { - console.log(data.toString()) -}) - -socket.on('close', () => { - console.log('-> disconnected by server') -}) \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/net-sockets-are-streams/client.js b/Chapter03/communicating-over-sockets/net-sockets-are-streams/client.js deleted file mode 100644 index a5eeb2b..0000000 --- a/Chapter03/communicating-over-sockets/net-sockets-are-streams/client.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const net = require('net') - -const socket = net.connect(1337) -const name = process.argv[2] || 'Dave' - -socket.write(name) - -socket.pipe(process.stdout) - -socket.on('close', () => { - console.log('-> disconnected by server') -}) \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/net-sockets-are-streams/echo-client.js b/Chapter03/communicating-over-sockets/net-sockets-are-streams/echo-client.js deleted file mode 100644 index 3119883..0000000 --- a/Chapter03/communicating-over-sockets/net-sockets-are-streams/echo-client.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict' - -process.stdin.pipe(require('net').connect(1338)).pipe(process.stdout) \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/net-sockets-are-streams/echo-server.js b/Chapter03/communicating-over-sockets/net-sockets-are-streams/echo-server.js deleted file mode 100644 index 998f7e9..0000000 --- a/Chapter03/communicating-over-sockets/net-sockets-are-streams/echo-server.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict' - -require('net').createServer((socket) => socket.pipe(socket)).listen(1338) \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/net-sockets-are-streams/server.js b/Chapter03/communicating-over-sockets/net-sockets-are-streams/server.js deleted file mode 100644 index 8e25382..0000000 --- a/Chapter03/communicating-over-sockets/net-sockets-are-streams/server.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const net = require('net') - -net.createServer((socket) => { - console.log('-> client connected') - socket.once('data', name => { - socket.write(`Hi ${name}!`) - }) - socket.on('close', () => { - console.log('-> client disconnected') - }) -}).listen(1337) \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/server.js b/Chapter03/communicating-over-sockets/server.js deleted file mode 100644 index eaa9fc8..0000000 --- a/Chapter03/communicating-over-sockets/server.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const net = require('net') - -net.createServer((socket) => { - console.log('-> client connected') - socket.on('data', name => { - socket.write(`Hi ${name}!`) - }) - socket.on('close', () => { - console.log('-> client disconnected') - }) -}).listen(1337, 'localhost') \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/udp-sockets/client.js b/Chapter03/communicating-over-sockets/udp-sockets/client.js deleted file mode 100644 index 94f6d18..0000000 --- a/Chapter03/communicating-over-sockets/udp-sockets/client.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const dgram = require('dgram') - -const socket = dgram.createSocket('udp4') -const name = process.argv[2] || 'Dave' - -socket.bind(1400) -socket.send(name, 1339) - -socket.on('message', (data) => { - console.log(data.toString()) -}) diff --git a/Chapter03/communicating-over-sockets/udp-sockets/server.js b/Chapter03/communicating-over-sockets/udp-sockets/server.js deleted file mode 100644 index eebebf6..0000000 --- a/Chapter03/communicating-over-sockets/udp-sockets/server.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' - -const dgram = require('dgram') - -const socket = dgram.createSocket('udp4') -socket.bind(1339) - -socket.on('message', (name) => { - socket.send(`Hi ${name}!`, 1400) -}) diff --git a/Chapter03/communicating-over-sockets/unix-sockets/client.js b/Chapter03/communicating-over-sockets/unix-sockets/client.js deleted file mode 100644 index baf60fe..0000000 --- a/Chapter03/communicating-over-sockets/unix-sockets/client.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -const net = require('net') - -const socket = net.connect('/tmp/my.socket') -const name = process.argv[2] || 'Dave' - -socket.write(name) - -socket.on('data', (data) => { - console.log(data.toString()) -}) - -socket.on('close', () => { - console.log('-> disconnected by server') -}) \ No newline at end of file diff --git a/Chapter03/communicating-over-sockets/unix-sockets/server.js b/Chapter03/communicating-over-sockets/unix-sockets/server.js deleted file mode 100644 index d5a191a..0000000 --- a/Chapter03/communicating-over-sockets/unix-sockets/server.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const net = require('net') - -net.createServer((socket) => { - console.log('-> client connected') - socket.on('data', name => { - socket.write(`Hi ${name}!`) - }) - socket.on('close', () => { - console.log('-> client disconnected') - }) -}).listen('/tmp/my.socket') \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/checking-file-existence/check.js b/Chapter03/fetching-meta-data/checking-file-existence/check.js deleted file mode 100644 index 0008c51..0000000 --- a/Chapter03/fetching-meta-data/checking-file-existence/check.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -const fs = require('fs') - -const exists = (file) => new Promise((resolve, reject) => { - fs.access(file, (err) => { - if (err) { - if (err.code !== 'ENOENT') { return reject(err) } - return resolve({file, exists: false}) - } - resolve({file, exists: true}) - }) -}) - -exists(process.argv[2]) - .then(({file, exists}) => console.log(`"${file}" does${exists ? '' : ' not'} exist`)) - .catch(console.error) \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/meta.js b/Chapter03/fetching-meta-data/getting-symlink-information/meta.js deleted file mode 100644 index 89a835e..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/meta.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict' - -const fs = require('fs') -const path = require('path') -const tableaux = require('tableaux') - -const write = tableaux( - {name: 'Name', size: 20}, - {name: 'Created', size: 30}, - {name: 'Inode', size: 10}, - {name: 'Mode', size: 8}, - {name: 'Lnks', size: 4}, - {name: 'Size', size: 6} -) - -function print(dir) { - fs.readdirSync(dir) - .map((file) => ({file, dir})) - .map(toMeta) - .forEach(output) - write.newline() -} - -function toMeta({file, dir}) { - const stats = fs.lstatSync(path.join(dir, file)) - let {birthtime, ino, mode, nlink, size} = stats - birthtime = birthtime.toUTCString() - mode = mode.toString(8) - size += 'B' - return { - file, - dir, - info: [birthtime, ino, mode, nlink, size], - isDir: stats.isDirectory(), - isSymLink: stats.isSymbolicLink() - } -} - -function output({file, dir, info, isDir, isSymLink}) { - if (isSymLink) { - outputSymlink(file, dir, info) - return - } - write(file, ...info) - if (!isDir) { return } - const p = path.join(dir, file) - write.arrow() - fs.readdirSync(p).forEach((f) => { - const stats = fs.lstatSync(path.join(p, f)) - const style = stats.isDirectory() ? 'bold' : 'dim' - if (stats.isSymbolicLink()) { f = '\u001b[33m' + f + '\u001b[0m'} - write[style](f) - }) - write.newline() -} - -function outputSymlink(file, dir, info) { - write('\u001b[33m' + file + '\u001b[0m', ...info) - process.stdout.write('\u001b[33m') - write.arrow(4) - write.bold(fs.readlinkSync(path.join(dir, file))) - process.stdout.write('\u001b[0m') - write.newline() -} - -print(process.argv[2] || '.') diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/absolute-symlink b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/absolute-symlink deleted file mode 100644 index cad2309..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/absolute-symlink +++ /dev/null @@ -1 +0,0 @@ -/tmp \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/link-to-symlink b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/link-to-symlink deleted file mode 100644 index 8d501ff..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/link-to-symlink +++ /dev/null @@ -1 +0,0 @@ -my-symlink \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-file b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-file deleted file mode 100644 index 19e7bc3..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-file +++ /dev/null @@ -1 +0,0 @@ -my edit diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-private-file b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-private-file deleted file mode 100644 index e69de29..0000000 diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-subdir/another-file b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-subdir/another-file deleted file mode 100644 index e69de29..0000000 diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-subdir/my-subsubdir/too-deep b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-subdir/my-subsubdir/too-deep deleted file mode 100644 index e69de29..0000000 diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-subdir/subdir-symlink b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-subdir/subdir-symlink deleted file mode 100644 index 993f945..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-subdir/subdir-symlink +++ /dev/null @@ -1 +0,0 @@ -another-file \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-symlink b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-symlink deleted file mode 100644 index 6f787df..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/my-symlink +++ /dev/null @@ -1 +0,0 @@ -my-file \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/relative-symlink b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/relative-symlink deleted file mode 100644 index 30676ba..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/relative-symlink +++ /dev/null @@ -1 +0,0 @@ -../meta.js \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/too-deep b/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/too-deep deleted file mode 100644 index 675b184..0000000 --- a/Chapter03/fetching-meta-data/getting-symlink-information/my-folder/too-deep +++ /dev/null @@ -1 +0,0 @@ -my-subdir/my-subsubdir/too-deep \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/manipulating-meta-data/make-file-efficiently.js b/Chapter03/fetching-meta-data/manipulating-meta-data/make-file-efficiently.js deleted file mode 100644 index 76f6308..0000000 --- a/Chapter03/fetching-meta-data/manipulating-meta-data/make-file-efficiently.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const fs = require('fs') -const {execSync} = require('child_process') - -const file = process.argv[2] -if (!file) { - console.error('specify a file') - process.exit(1) -} -try { - fs.accessSync(file) - console.error('file already exists') - process.exit(1) -} catch (e) { - makeIt() -} - -function makeIt() { - const nobody = Number(execSync('id -u nobody').toString().trim()) - const fd = fs.openSync(file, 'w') - fs.fchmodSync(fd, 0) - fs.fchownSync(fd, nobody, nobody) - console.log(file + ' created') -} - diff --git a/Chapter03/fetching-meta-data/manipulating-meta-data/make-file.js b/Chapter03/fetching-meta-data/manipulating-meta-data/make-file.js deleted file mode 100644 index 57c26f9..0000000 --- a/Chapter03/fetching-meta-data/manipulating-meta-data/make-file.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict' - -const fs = require('fs') -const {execSync} = require('child_process') - -const file = process.argv[2] -if (!file) { - console.error('specify a file') - process.exit(1) -} -try { - fs.accessSync(file) - console.error('file already exists') - process.exit(1) -} catch (e) { - makeIt() -} - -function makeIt() { - const nobody = Number(execSync('id -u nobody').toString().trim()) - fs.writeFileSync(file, '') - fs.chownSync(file, nobody, nobody) - fs.chmodSync(file, 0) - console.log(file + ' created') -} \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/meta.js b/Chapter03/fetching-meta-data/meta.js deleted file mode 100644 index 95ae804..0000000 --- a/Chapter03/fetching-meta-data/meta.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict' - -const fs = require('fs') -const path = require('path') -const tableaux = require('tableaux') - -const write = tableaux( - {name: 'Name', size: 20}, - {name: 'Created', size: 30}, - {name: 'Inode', size: 10}, - {name: 'Mode', size: 8}, - {name: 'Lnks', size: 4}, - {name: 'Size', size: 6} -) - -function print(dir) { - fs.readdirSync(dir) - .map((file) => ({file, dir})) - .map(toMeta) - .forEach(output) - write.newline() -} - -function toMeta({file, dir}) { - const stats = fs.statSync(path.join(dir, file)) - let {birthtime, ino, mode, nlink, size} = stats - birthtime = birthtime.toUTCString() - mode = mode.toString(8) - size += 'B' - return { - file, - dir, - info: [birthtime, ino, mode, nlink, size], - isDir: stats.isDirectory() - } -} - -function output({file, dir, info, isDir}) { - write(file, ...info) - if (!isDir) { return } - const p = path.join(dir, file) - write.arrow() - fs.readdirSync(p).forEach((f) => { - const stats = fs.statSync(path.join(p, f)) - const style = stats.isDirectory() ? 'bold' : 'dim' - write[style](f) - }) - write.newline() -} - -print(process.argv[2] || '.') diff --git a/Chapter03/fetching-meta-data/my-folder/my-file b/Chapter03/fetching-meta-data/my-folder/my-file deleted file mode 100644 index 19e7bc3..0000000 --- a/Chapter03/fetching-meta-data/my-folder/my-file +++ /dev/null @@ -1 +0,0 @@ -my edit diff --git a/Chapter03/fetching-meta-data/my-folder/my-private-file b/Chapter03/fetching-meta-data/my-folder/my-private-file deleted file mode 100644 index e69de29..0000000 diff --git a/Chapter03/fetching-meta-data/my-folder/my-subdir/another-file b/Chapter03/fetching-meta-data/my-folder/my-subdir/another-file deleted file mode 100644 index e69de29..0000000 diff --git a/Chapter03/fetching-meta-data/my-folder/my-subdir/my-subsubdir/too-deep b/Chapter03/fetching-meta-data/my-folder/my-subdir/my-subsubdir/too-deep deleted file mode 100644 index e69de29..0000000 diff --git a/Chapter03/fetching-meta-data/my-folder/my-symlink b/Chapter03/fetching-meta-data/my-folder/my-symlink deleted file mode 100644 index 6f787df..0000000 --- a/Chapter03/fetching-meta-data/my-folder/my-symlink +++ /dev/null @@ -1 +0,0 @@ -my-file \ No newline at end of file diff --git a/Chapter03/fetching-meta-data/package.json b/Chapter03/fetching-meta-data/package.json deleted file mode 100644 index a8ac8ce..0000000 --- a/Chapter03/fetching-meta-data/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "fetching-meta-data", - "version": "1.0.0", - "description": "", - "main": "meta.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "tableaux": "^1.0.1" - } -} diff --git a/Chapter03/interfacing-with-standard-io/base64.js b/Chapter03/interfacing-with-standard-io/base64.js deleted file mode 100644 index 19a1796..0000000 --- a/Chapter03/interfacing-with-standard-io/base64.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -process.stdin.on('data', data => { - process.stderr.write(`Converting: "${data}" to base64\n`) - process.stdout.write(data.toString('base64') + '\n') -}) diff --git a/Chapter03/interfacing-with-standard-io/piping/base64.js b/Chapter03/interfacing-with-standard-io/piping/base64.js deleted file mode 100644 index dc5a502..0000000 --- a/Chapter03/interfacing-with-standard-io/piping/base64.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict' - -const encode = require('base64-encode-stream') -process.stdin.pipe(encode()).pipe(process.stdout) \ No newline at end of file diff --git a/Chapter03/interfacing-with-standard-io/piping/package.json b/Chapter03/interfacing-with-standard-io/piping/package.json deleted file mode 100644 index b8e23bb..0000000 --- a/Chapter03/interfacing-with-standard-io/piping/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "piping", - "version": "1.0.0", - "main": "base64.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "base64-encode-stream": "^1.0.0" - }, - "devDependencies": {}, - "keywords": [], - "description": "" -} diff --git a/Chapter03/watching-files-and-directories/my-file.txt b/Chapter03/watching-files-and-directories/my-file.txt deleted file mode 100644 index 9744e43..0000000 --- a/Chapter03/watching-files-and-directories/my-file.txt +++ /dev/null @@ -1 +0,0 @@ -back again diff --git a/Chapter03/watching-files-and-directories/package.json b/Chapter03/watching-files-and-directories/package.json deleted file mode 100644 index 554bfe0..0000000 --- a/Chapter03/watching-files-and-directories/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "watching-files-and-directories", - "version": "1.0.0", - "description": "", - "main": "watcher.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "human-time": "0.0.1" - } -} diff --git a/Chapter03/watching-files-and-directories/watcher.js b/Chapter03/watching-files-and-directories/watcher.js deleted file mode 100644 index 4c45cf1..0000000 --- a/Chapter03/watching-files-and-directories/watcher.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict' - -const fs = require('fs') -const human = require('human-time') - -const interval = 5007 -const file = process.argv[2] -let exists = false - -if (!file) { - console.error('supply a file') - process.exit(1) -} - -const created = ({birthtime}) => - !exists && (Date.now() - birthtime) < interval - -const missing = ({birthtime, mtime, atime, ctime}) => - !(birthtime|mtime|atime|ctime) - -const updated = (cur, prv) => cur.mtime !== prv.mtime - -fs.watchFile(file, {interval}, (cur, prv) => { - if (missing(cur)) { - const msg = exists ? 'removed' : 'doesn\'t exist' - exists = false - return console.log(`${file} ${msg}`) - } - - if (created(cur)) { - exists = true - return console.log(`${file} created ${human((cur.birthtime))}`) - } - - exists = true - - if (updated(cur, prv)) { - return console.log(`${file} updated ${human((cur.mtime))}`) - } - - console.log(`${file} modified ${human((cur.mtime))}`) -}) - - diff --git a/Chapter03/watching-files-and-directories/watching-with-chokidar/package.json b/Chapter03/watching-files-and-directories/watching-with-chokidar/package.json deleted file mode 100644 index ff408a5..0000000 --- a/Chapter03/watching-files-and-directories/watching-with-chokidar/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "watching-with-chokidar", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "chokidar": "^1.6.0", - "human-time": "0.0.1" - } -} diff --git a/Chapter03/watching-files-and-directories/watching-with-chokidar/watcher.js b/Chapter03/watching-files-and-directories/watching-with-chokidar/watcher.js deleted file mode 100644 index 398c83d..0000000 --- a/Chapter03/watching-files-and-directories/watching-with-chokidar/watcher.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict' - -const chokidar = require('chokidar') -const human = require('human-time') -const watcher = chokidar.watch(process.argv[2] || '.', { - alwaysStat: true -}) - -watcher.on('ready', () => { - watcher - .on('add', (file, stat) => { - console.log(`${file} created ${human((stat.birthtime))}`) - }) - .on('unlink', (file) => { - console.log(`${file} removed`) - }) - .on('change', (file, stat) => { - const msg = (+stat.ctime === +stat.mtime) ? 'updated' : 'modified' - console.log(`${file} ${msg} ${human((stat.ctime))}`) - }) - .on('addDir', (dir, stat) => { - console.log(`${dir} folder created ${human((stat.birthtime))}`) - }) - .on('unlinkDir', (dir) => { - console.log(`${dir} folder removed`) - }) -}) - \ No newline at end of file diff --git a/Chapter03/working-with-files/asynchronous-file-operations/clean.dat b/Chapter03/working-with-files/asynchronous-file-operations/clean.dat deleted file mode 100644 index 7a137ed..0000000 --- a/Chapter03/working-with-files/asynchronous-file-operations/clean.dat +++ /dev/null @@ -1,140 +0,0 @@ -��b�V���������E��E�����h]k�������������0��R���|p}8R�@��_��R�S�x��!�S��|p}�S�@��_��v�yS�����������@��_�����������Y�(R�h]{�������������|�ha@R�-�-���|������������������R�����^�������������T��T��V��]��^�(d�`d�Xf�g��l�xr�8s��s��v�w��w�p}0U����_�V�0V��V�p}�V����_�����h]w������������x��wh] w�������������� wxi w��������8U��l w�������������T�U��U��U�xiw���������U�8-��lw����������������PU��U�a�^w���������T�V�����Xew`V�h])w��������������-wxi-w��������0W��l-w�������������V�W��W��W�`2��W�xi9w���������W�����@-��l.w����������������HW��W��xi@w���������X�:H-��p}w}���������@��_������������Ɛx̐�̐�͐ϐА@ѐpҐhؐ -��������������ĐXe -�HƐh]W�������������襐HȐ�ȐP���������8�Ɛxi`���������Pǐ�A��p\����������Ɛ ǐ`���������ΐh]J}���������������S}h]V}���������������W}xiZ}���������Ȑ.�`oX}��������&�Ȑ�Ȑ^T}��������HȐɐ����XeJ}@ɐfg}����h��������hg+}HÐxÐ�ɐ�����e�}����h����hgq|��@��ʐ����h]�}������������P���}xi�}���������ʐ .�xi�}��������ː��(.��p�}��������-Xʐ�ʐ`���������ː�АHҐX���͐��|p}�͐@��_��ΐ�ΐ�ΐPϐ�|p}pϐ@��_��}E~����������@��_�͐��������������������襐h]�����������������l��������0͐^u���������x̐ΐ����Xep�hΐ0Аѐ8ѐL�hǐ�ǐ�ΐ����h]���������������5��xi�����������0�l��������������Hϐ�А�А�ѐ����������x��h]~�������������੐~xi"~������������P�^ ~��������0АhА��������Xe~�Аh]1~������������P��4~h]7~����������������8~xi;~�����������ѐ0.�`o9~��������&8ѐpѐ^5~��������ѐ�ѐ����Xe1~�ѐ�h����hg�}���� ː`ː`Ґ����h]P~������������x��T~xiY~��������Ӑ.8.��pU~��������-�Ґ�Ґ`���������Ӑ|(ܐ���_��Ր�Ր֐�֐X���Ր��|p}�Ր@��_��֐�֐�֐Pא�|p}pא@��_�b~*������@��_���������hؐ0ؐ8ِpِڐېh]����������������xi�����אl����xא�אh]�~������������蟐�~xi�~�������������ؐ@.�xi�~����������ؐ��H.��p�~����������-0ؐ�ؐh]�~������������蟐�~h]�~����������������~� ^�~��������8ِpِ�����Xe�~�ِh]�~��������������xi���������xڐP.��p���������-ڐHڐ�n��������5�ڐh]��������������xi ��������hېX.�^��������ې8ې����Xe�ې�h����hg�~�ڐ�ې�ې����hg�~�ؐ�ِ�ې����`�����������@��ÐHȐ�ȐXʐ0Аѐ8ѐ�Ґ0ؐ8ِpِڐې`ݐh���3�@@��O��Y�Xi�xs�H������˃������P��%�h]4������������蟐<xiB����������ݐ`.�xiA���������ސ��h.��p=���������-`ݐ�ݐ�n=���������5(ސ`���������ސK����@����)�0f��p��r��s����Տ��h��`��X��������X�������|p}��@��_�������������|p}���@��_�E�������@��_���������h��h]����������������xi������������p.�xi�����������������x.�^���������h���������Xe��0���h����hg0� hސ�ސ�������hgL~ Ӑ`Ӑ�������H��������`�����������@��ÐHȐ�ȐXʐ0Аѐ8ѐ�Ґ0ؐ8ِpِڐې`ݐh��8���|p}x��إ������ج�x����`��x��8��ر�H��h����� ������������ԃփ8ƒ�ƒ�ȃ�Ƀ�Ƀ�˃�̃p̓�ԃ�Ճ�փ�ۃ�ۃ`܃����������������8�������������������������(��������������8��p��(�`�`��� �x�������X�����0�h��@������,�x-�x.�8/��T��T��V��]��^�(d�`d�Xf�g��l�xr�8s��s��v�w��w��}��~�`�������x��H����ȗ�@�����H����@�����0�����@�����0�����(��P�����8�����H��H��������`�����������@��ÐHȐ�ȐXʐ0Аѐ8ѐ�Ґ0ؐ8ِpِڐې`ݐh����������������������H�������`�����X�H�������H�8�p����������������������P �@!�x!�p"�0#� $�X$��&�H'�8(�p(��*�p+�0,�h-��.� /��/�1��2�h]K�������������8��O�`�����������X��0��������|p}�����_�������������|p}������_�Q�x�h]�������������蟐�����xi�������������.�xi���������8�����.��p���������-�����h]!�������������P��$�xi*�������������.�xi)���������@�����.��p%���������-�����`o���������P��X��h]x�����������������xi����������@���.��p����������-�����`o,������������X��h]ـ��������������������xi����������@���.��p����������-�����h]��������������蟐��h]�������������P���xi -�����������8���.�`o���������'������p���������-���P��`o����������X�����h]�������������蟐 �h]%����������������.�xi1�������������.�`o/���������&H������p!�����������-�����`o ��������������`o�������������H��`����������^� �����������Xe���h]��� ��������x������|p}8��@��_������8�� ����|p}���@��_�5� -����������@��_��������������X������|���*�����p����_��������������`�����X�H�������H�8�p���H��:-����v�= `�� ������h]A�������������P��D�xiJ������������.�xiI���������H�����.��pE���������-������nE����������5`��`����������������� ���������HC ���������������� ����|p}@��@��_��� ��@�� ����|p}���@��_�M����������@��_���������h]�����������5������������z����������� ��������h]�������������������`�����X�H�������H�8�p�����������H���l�����������������������������hg���(�����h]����h][����������������d�xii���������������.��pe���������-����h]n�������������p��x�`ok��������� �`�h]��������������0����xi����������@�p�l�����������������h]��������������0����xi������������h�l�������������������h]����������������������xi������������ Ol��������������X���(�H���h�h]�������������� ����h]��������������P�����l���������������������e^�����������������^����������X������� Xe��`�h]ˁ������������0��΁xi΁��������0�� p�l΁���������������h]ց������������0��فxiف����������� h�lف����������������h]������������������� xi������������� Ol��������������H����8�p�����h]��������������������h]��������������P�����l�����������������������^߁���������������^ԁ��������H� �����XeˁP �hgW� ����� ������h����hg=�������� �����`��������p -�����X&�P)�|�@ -�HC ��� ��������HC ����x��x ���|p}� �@��_�X �x �P%�!��|p}8�@��_��F�����������@��_�����������ҏ�uرh ���� � u�(���� ���� -��ߎH�� ������}6� �P��A�������*� � � ���������������������P �@!�x!�p"�0#�������������� ������������������������pn�h]����������������%�xi*�����������`��.��p&���������-��0�h]/�������������p��9�`o,���������x���`��������x�������A�������*� � pn�����b -� -�����|p}��@��_�`����� ��|p}@�@��_�;���������@��_���'���������ߎ�����������E�������������Э.this_function]�6�P��s�`����������������������@�x�pxyzP�������h�P�h]E�������������0��H�xiH���������h�h�lH��������������8�h]P���������������T�xiT���������(� OlT�����������������������@�h][������������� ��b�h]d�������������蟐l��lU�����������������@���^N����������� �����XeE�x�h]w�������������0��z�xiz���������H�p�lz����������������h]������������������xi����������� Ol������������������p������רh]�������������� ����h]��������������P�����l������������������� �`���^����������`������Xew�X�`���������X"�8%��.�(/�p/� 1�h1��1�(7�� -����|p}0�@��_����0����|p}��@��_����֩������@��_�©��������h�����0��x��h�����`��������H�H�����P���P �@!�x!�p"�0#� $�X$�X1�X2��3��4��7��\��M� N�P�XP�hj��j�0l�xl�h]��������������0����xi������������h�l������������������h]����������������‚xi‚��������� � Ol‚������������P �� � !�@!�x!���h]ɂ���������������҂h]Ԃ������������蟐܂�lÂ������������������ �!�΀^���������� ��!�����Xe��"�h]��������������0����xi�����������"�p�l��������������p"��"�h]������������������xi�����������#� Ol��������������0#�h#�$� $�X$�PI�h]������������������h]�������������P�� ��l��������������������#��#�%�^�����������"��$�����Xe���$����������������������P �@!�x!�p"�0#� $�X$��&�H'�8(�p(�����H��������ؤ�hg���0�������h]�������������0���xi�����������&��l��������������&��&�h]&���������������*�xi*�����������'� Ol*�������������H'��'�(�8(�p(�(;�h]1�������������蟐9�h];�������������P��>��l+������������������'�(�^$���������'��(�����Xe�)�hg�������( -����� 4�������������x����`��Й�H��x��Р�ॐШ�Ȫ�ح����h)�P2��2�p��łXł�ł�Ƃ ǂقh]P����������������Y�xi\���������+��.��pZ����������0�*��*�h]e�������������0��h�xih����������+���lh�������������p+��+�h]o���������������s�xis����������,� Ols�������������0,�h,�-� -��-�@c�xiz����������P-��.�h]}������������������xi������������-��.�`o����������'h-��-��lt������������������,��,�^m����������+�(.�����Xee��.�h]��������������p����h]��������������0����xi�����������/���l�������������� /�X/�h]������������������xi����������H0� Ol���������������/�0��0��0�1��M�xi�����������1��.�h]ă������������ ��˃�l�������������������`0��0���^�����������/�P1�����Xe���1��h����hg���.��1�2�����hgL�0+��.� 2�����h]ڃ������������0��݃`fӃ�2�HC x���� ����h]�����������������2�����ha����3�x��h]�����������������2������v�o��������^�������������p3��3�����Xe�����3��t�o�����"��x��X���@��_��4��4��4��o�B�0��84�����xi��������05���xi�������x5�c5�H5���������delimiterg�]!��5� ���Cxi�������(6��5�;��]!�@6��g;�xi�������6�H6��5�x6���������xi������7���xi����������6�07���������posix]!����7��DA"xi��������7��7�xi���������7�8��������� j�K�����4������h]"�H��������9�#�ha��8��HC ��� #�^����D������8�`8�����Xe����P9�`'��:�@�H̔h]-��������������7�2�H�Ȋ�(�������xi[��������:�H��@<�H��|p}�K�@��_� =�@=�r�C'�V� �>�@��?��|p}>�@��_�t�����������@��_���������������Ċ���C���v@�Ƹ‰H -?��k�P� -P?�:-���PE��s���� �>�v�= `>��A�N����Ҋ�Ҋ`֊�֊8A��A�0C��C��D�xK�(V��I��M��N��O�8P�W��W�X�@X�pA�hC�0E��K��|��|�`~��~����0�H1�(3�HC �:�� ��������HC �:�H -����HC �:�� -������������ȋ Hˋ -�ϋ 0�� ��� ��h��(@���h@�xB�pD�8N��t����`�`}������@�0�`B�h]��������������`>���xi����������� A��h]���������������A���ha}�8A��:�HC �:�`>���h]�����������������A�����^��������������A��@�����Xe����B�`�������B���XD�h]������������������xi�����������P�h]���������������C���ha��0C��:�HC �:�����h]�����������������C�����^��������������C�C�����Xe����D�`�������D�h]�����������������h]��������������PE���ha���D��:�HC �:�����:�(G���|p}HG�@��_�H�(H��n�!�H��|p}�H�@��_�̄���������@��_����������Q����8���P�@Q�xR���P��Х���p�����蛎`ˎ�ˎ�I��M��N��O�8P�W��W�X�@X��]�(^��^��^��`�a��a�(ŽpŽ�Î�������� "��"��\� ]�h]ф������������@�҄h]Մ������������?�ބxiބ��������HJ�X�lބ�������������I�J�xi������������J�/�`o����������'`J��J�`̈́����pK��� N�h]��������������PM���hä́xK��E����0���PE��s�0���ۏ�ۏ���C���v@�PM�Ƹ‰� �>�v�= �V�&�(5H -?��k�P� -P?�:-������`>��A�N���@�HC �:�@���h]����������������PM�����^��������������M��J�����Xe�����M��cȄ�����P�(K��O��P�h]��������������PM���xi������������N�/�xi����������8O���/��p�����������2�N�O�h]���������������C���n����������5�O�`o����������PO��O�h] �������������PM� -�p -����������8P�����Xe -�pP�`��������Q��U��a��b� i�k��n�PxS�X�[�^�E� S���|p}@S�@��_�T� T�`k�!�T��|p}�T�@��_������������@��_�I����������d�1 ��23x����56P��(��89X+�X��;<�.�5�>�>�?X��@���A(+�BW��W�X�@X��]�(^��^��^��`�a��a�8b��b�Pi��i�Hj��P� ��(� ��`������U�h]������������� �h]��������������V��ha�(V��Q�HC �:� �@��pA�hC�0E��K�`V�h]*�������������PM�+�xi/���������xW�/��p,���������2W�HW�h]:��������������V�>�h]A�������������?�J�h]K�������������PM�L�lJ�������������X�@X�^?����������W�xX�����Xe:��X�`��������hY��`��a��[�^�h�kov y�Q�p[���|p}�[�@��_�P\�p\��\�]��|p}0]�@��_�Z���|�������@��_�ŀ�����������6P��78�|�X+�:;h��.�=>�>�X��@A(+�x��Cp �� -��]�(^��^��^��`�a�� �� �� ��P��� ��(� ��h]h�������������PE�k�h]p��������������ٔy��pl���������-�]�(^�h]��������������PE���h]��������������0ٔ��xi����������@_��l���������������^�_��_��l������������������X_��_�^�����������^��_�����Xe�� `��h����hgd�`^�p`��`�����h]���������������V���h]��������������PE���^�����������`�a�����Xe��8a�hg&��W�Y� Y�����h]����������������Džb�8b�h]ȅ�������������V�̅�l�������������������a�b�Xe��pb�h]���������������V���xi����������Hc�X�l���������������b�c�xi����������c� /��p���������-`c��c�`��������pd��h��Q�xf���|p}�f�@��_�Xg�xg��g�h��|p}8h�@��_� �$�������@��_����������e�8N��h����hg���c�(d�i�����h],��������������A�8�h];��������������V�?�xiB����������i�`�`o@���������&�i��i�h]H��������������A�T�`oF���������&j�Hj�^9���������Pi��j�����Xe,��j�h]\��������������C�l�W��W�X�@X��]�(^��^��^��`�a��a�8b��b�Pi��i�Hj�(k�hl�h]o��������������V�s�xis����������l��ls�������������hl��l�8m�Xm�xi����������m�(/��lt������������������l�(m�xi����������(n�/0/��p����������-�m��m�^m���������(k�@n�����Xe\��n��I��M��N��O�8P�W��W�X�@X��]�(^��^��^��`�a��a�8b��b�Pi��i�Hj�(k�hl�8A��A�0C��C��D�xK�(V��I��M��N��O�8P�W��W�X�@X��]�(^��^��^��`�a��a�8b��b�Pi��i�Hj�(k�hl��p�0q��q�h]S��������������A�_�h]b���������������v�xq��q� t�h]w��������������A���h]���������������C���8A��A�0C��C��D�xK�(V��I��M��N��O�8P�W��W�X�@X��]�(^��^��^��`�a��a�8b��b�Pi��i�Hj�(k�hl��p�0q��q��q�u�z��{��|�����n����������5�q��lb�����������������0q�hq�^`����������p�Pt�����XeS��t�h]���������������C���`���������u��|��:��w���|p}�w�@��_�xx��x��x�8y��|p}Xy�@��_��� �������@��_���������z��{�h]���������������A�̇xi̇���������z�X�l̇������������z�Pz�xiև��������{�8/��pԇ��������0�z��z�xi�����������{�`�h]���������������A���`o����������&`{��{�`f���{�xi���������h|�`�`f�8|�hg�� {� |��|�����h]*��������������A�6�xi6���������0}�X�l6��������������|�}�xi@����������}�@/��p>���������0H}��}�`��������X~����:�`����|p}���@��_�@��`��������|p} ��@��_�C�e�������@��_������������h]R��������������A�^�`fK����`��������x��H���:������|p}���@��_�`�������� ���|p}@��@��_�k���������@��_���������xiz���������0��(2�`fs���hg&��}�~�0������hg��u�Hu�`������HC �:�H�����h]�����������������������ha�������:�h]������������������������vd���������^�������������`���������Xe��������td������"H��:�@��@��_�������Ȋ�d�p:�(������xi������� ��x5�����x5��|p}���@��_���������!`��@������|p}���@��_�����������@��_����������EX���n�H -����k�P� -Џ�:-����������~� @��v�= А�&�(5А����h��Б�x��蔑��������������蜑P�����������������8�����HC 8��� ��������HC 8��H -��������HC 8��� -�������� �����h]��������������А���HC 8�� ����H�� -`��0��`����������ȥ�h]����������������ˆ���Б�h]È������������А�Lj�l������������������h�����Xe����h]ӈ������������А�׈xi׈�����������X�l׈������������x�����xi����������h��H/��p߈��������-���8��xi�������������(2�`f������h����hgψ����� ������`������������h]��������������E �h]�������������А��xi���������P���l�������������蔑 �����ؕ�xi �����������P/��l�����������������h�����xi'������������/X/��p#���������- ��x��h]'�������������X��)�ha����8��HC 8���E)�^����������������������Xe�������`4�����P�����h]:����������������K�h]N�������������А�R�xiR�������������lR����������������Ș�`�����h]^�������������А�b�xib���������虑X�lb�������������������xil���������p��`/�`oj���������'��@���lS�������������������P��xis���������P��/h/��po���������-Ț� ��h]s���������������u�ha4����8��HC 8�����u�^����������������h������Xe����H��h]��������������А���h]������������������0��P�����h]��������������А���h]��������������X��ȉ�n����������5����l������������������蜑 ��^��������������������Xe��H��h]ԉ������������А�؉xi؉����������X�l؉���������������螑xi�������������p/��p����������-0��p��h]��������������X�����n����������5���`o�������������0��h]��������������А��xi�����������(2�^������������ؠ�����Xe�� ���h����hgЉ`��p���������h]�������������А�����h��Б�x��蔑��������������蜑P��������������ȡ���������x��Ч�xi���������8��X�l�������������ȡ���xi������������x/��p���������0P�����h]#���������������4�`o ���������أ���h]<�������������А�@�xiD������������`�^A�������������Ȥ�`������`oB���������&���Ȥ�Xe<����h����hg �P������������h]R�������������X��\�xik���������`��`�h]q�������������А�u�`oo���������&0��x��`fd�����h����hgN�������������p��`��0��`����������ȥ�����h]��������������А���`f{�Ч�HC 8��x5�����h]���������������� ������ha����h��8��h]���������������� �������v����������^�����������������������Xe���� ���t�������"x5�8�����@��_�����(��������������xi�����������E� ���E�|p}@��@��_��� ��@�����������|p}୑@��_����������@��_���������H -讑�k�P� -0��:-��� ���v�= 0��&�(50�����Ȱ�0��ر� ����HC ���� ��������HC ���H -��������HC ���� -�������� �����h]��������������0����HC ��� �������එ���x��h]����������������NJ��0��h]Ȋ������������0��̊�l������������������Ȱ���Xe��h��h]ڊ������������0��ފxiފ��������@��X�lފ������������ر���xi����������Ȳ��/��p����������0X�����h]��������������0����xi��������������l�������������� ��X�������xi����������@���/��l���������������������೑xi���������഑/�/��p���������-X�����`o����������಑���`fӊ8��HC ����E����h]�����������������������ha����ص����h]������������������������v����������^�������������0��h������Xe��������t�������"�E���x���@��_������������P���������xi���������pv�����pv��|p}���@��_�p�����ۑ!0�����ߑX���|p}P��@��_�)���������@��_������������@�ƑƸ‰H -X���k�P� -���:-��p��hϑ�̙� ��v�= �~����v]�i���(���őϑHƑ8ǑpǑpȑ`Α�Α�ϑPБ�Б`ёxב�ב�ߑ`���őHϑHC ��� ��������HC ��H -����HC ��� -��������x��P��p������Ƒ8ݑ�ޑh]6�������������X��?�xi?��������� ��X�l?�������������������xiK�������������/��pG���������-8��x��xi[���������0��(2�`fT����h����hg2����H��`������`d�����近h]h��������������~�n�h]h����������������n�had�(����HC ���~�h���X‘��|p}x‘@��_�8ÑXÑxÑ�Ñ�|p}đ@��_�x�e�������@��_����������ɑHƑ8ǑpǑpȑ`Α�Α�ϑPБ�Б`ёxב�ב(ؑ`ّؑ�ّh]}�������������@�~�xi����������@ő�/�`y������ő�Ƒh]��������������Ƒ��hay��ő���HC ��@���h]����������������Ƒ����^�������������HƑő����Xe�����Ƒ�ct�����ɑXő0ȑ�ȑh]��������������Ƒ��h]��������������X����xi�����������ǑX�l��������������pǑ�Ǒ�p����������/8Ǒ�Ǒh]��������������Ƒ��p�����������pȑ����Xe���ȑ`��������Pɑ�͑Hё�ڑ���Xˑ��|p}xˑ@��_�8̑X̑x̑ �̑�|p}͑@��_���e�������@��_���������pӑ`Α�Α�ϑPБ�Б`ёxב�ב(ؑ`ّؑ�ّ`������ Α8Бh]��������������p����h]��������������X����h]��������������Ƒ��l��������������`Α�Αh]��������������hϑ��ha��ϑ�ɑHC ��p����h]����������������hϑ����^��������������ϑ�Α����Xe�����ϑh]ŋ��������������ϋ�Б�Бh]Ћ������������hϑӋ�lŋ����������������PБ�БXeŋ�Бh]��������������hϑ��xi�����������ёX�l��������������`ё�ёxi����������Pґ�/��p����������0�ё ґ`���������ґ�ڑ�ɑ�ԑ��|p}Ց@��_��Ց�Ց֑�֑�|p}�֑@��_���_�������@��_���������xב�ב(ؑ`ّؑ�ّh]������������������h] ��������������ٔ��p���������-xב�בh]����������������$�h]'�������������hϑ*�^%���������(ؑ`ؑ����Xe��ؑh]C����������������I�xiM���������hّ`�h]S�������������hϑV�`oQ���������&8ّ�ّ^J����������ّ�ّHڑ����`oK���������&ّ�ّXeC��ّhg���ב�ؑ�ڑ�����h����hg܋hґ�ґ�ڑ�������(���őϑHƑ8ǑpǑpȑ`Α�Α�ϑPБ�Б`ёxב�ב(ؑ`ّؑ�ّܑPܑhݑXޑh]n����������������t�h]y��������������ٔ���pu���������-ܑPܑxi�����������ܑ(2�`f���ܑ�h����hgj��ܑݑ(ݑ����h]���������������˔��xi�����������ݑx5�l��������������hݑ�ݑ8ޑXޑh]��������������������l�������������������ݑ(ޑ`f���ޑHC ��pv�����h]����������������ߑ����ha����Hߑ��h]����������������ߑ�����v���������^��������������ߑ�ߑ����Xe�������t������"pv���h���@��_�������������h�� ����xiÌ�����`��h)����h)��|p}�%� @��_�������{��z�n� ���(���|p}���@��_�ތr� ������@��_�������������/����潳�PE����~���H -���k�P� -H��:-��(U�fA��� ���v�= H/����v ���������H��`�����p����������������������(������H��p��� � ��h�}X����5�@H��v��)��.�{�(j�)����x���:�8�������x��h��`����������(�HC x��� ��������HC x��H -��������HC x��� -��������H/������/�H����h]ߌ�����������������h]�������������������HC x��H/�����HC x���/������+�#X��h�����������0��`��h]������������������������h]��������������������l������������������`�����Xe����h]����������������������h]������������������l�����������������p�����Xe���h]����������������"�h]'����������������)��p#���������-������xi8���������`���`f1�0���h����hg����x���������h]A����������������E�h]H��������������˔M�xiM���������p��H�lM���������������@��������h]V����������������Z��lN�����������������������^F������������0������XeA����h]a����������������c�h]f��������������˔k�xik������������H�lk�������������(��`�������h]t����������������v��ll�����������������������^d������������P������Xea����h]�������������������h]��������������������p����������-��H��xi��������������`f������h����hg~������ ������`ɍ�������`��h]͍������������PE�֍��H��`�����p����������������������(������H��8������������x�h������ �X���p �� -�� ���xiٍ�������� ���/�h]ٍ���������������ڍhaɍ8��x��HC x��PE�ڍh]�����������������������^�����������������������Xe������x������|p}(��@��_������(������|p}���@��_���U�������@��_���������p���������x�h��c���������������h]�������������������h]�������������������xi����������x��X�l����������������H���p����������/������h]���������������� �p����������������Xe�H��`���������������������|p}��@��_�������������|p}���@��_� �U�������@��_���������x�h�h]�����������������xi������������l�������������x���H�h�h])����������������2��l�������������������8�xi8���������(�/�/��p4���������-�����n4���������5@�fI�����h����hg�����������X��h�����������0��`��������� -�0�����!�8$�`Z���������h]^�������������(U�e�h]h����������������l�xil�����������X�ll��������������P�h]m���������������s�haZ���x���z�h���� X�P#����7 ����ˈ: �/����潳�(U���fA��� ���v�= H/����v �H -���k�P� -H��:-��k�8 �J��،�( ��(�A -PE����~���h�( �N��HC x��(U�s�h]����������������������^���������������������Xe����0�`y�������� �h]}�������������h���h]������������������h]�������������������`o����������' �X�h]��������������( ���hay���x��HC x��h���h]����������������( �����^�������������p �������Xe����� �`ǎ����X -� �h]ˎ������������k�ҎxiՎ��������� -��/�h]Վ������������8 �֎haǎ� -�x��HC x��k�֎h]����������������8 �����^�������������� �� -�����Xe����� �x��� ���|p}� �@��_�������P��|p}p�@��_���G�������@��_���������������� ���c܎����P�x�8�h]��������������8 ���h]�������������������xi���������� �X�l�������������������p����������/��8�h]��������������8 ��p�����������������Xe����`������������( �����|p}��@��_�������@��|p}`�@��_��G�������@��_��������� ��h]�����������������xi������������l������������� �X����h]�������������8 �$��l���������������������xi*�����������/�/��p&���������-H����n&���������5��f;�0��h����hg �(�X�p�������H��`�����p����������������������(������H��8������������x�h������ �X���p �� -�� ������� ��P���� �X���p ��!��!�H"��"��"��#�P%��(�`*�+�n�hr�1�P1��1�07�h7��<��<�0B� C�XC��I�`L��������h]P��������������z�U�h]X����������������Z�xiZ�����������X�lZ�������������P���h][�������������h�a�haL��x��HC x���z�a�p��� � �H� �0#��%��*�h]����������������h�����^���������������������Xe����0�`g�������� �h]k�������������،�p�h]t�������������h�y�h]|�������������8 ���`oz���������' �X�h]��������������( ���hag���x��HC x��،���h]����������������( �����^�������������p �������Xe����� �`ʏ����X!� $�h]Ώ������������X�ԏh]؏������������( �ߏh]��������������( ����p����������/�!��!�h]��������������( ���h]��������������( ���r؏��������"�H"��"�h]��������������P#���haʏ�"�x��HC x��X���h]����������������P#�����^��������������#��"�����Xe�����#�`������$�x)�h]�����������������xi����������$��/�xi���������8%����/�h]��������������(��ha�P%�x�����r��~�ހhn���<X�P#����7 �/����潳�(U���fA��@��*�Ƹ‰ k�8 �J��h�( �N������(��ˈ: H��@���GpB� ���v�= H/����v �،�( ��(�A -H -���k�P� -H��:-���z�h���� PE����~���HC x������h]�����������������(�����^��������������(�%�����Xe����()�`������)��+�h] �������������@�!�xi$���������H*��/�h]$��������������*�%�ha�`*�x��HC x��@�%�h]�����������������*�����^�������������+�*�����Xe����8+����X��h�����������0��`��������� -�0�����!�8$��)��0�����x��x��H.���|p}h.�@��_�(/�H/��y�C'�/��|p}0�@��_�/�ʔ������@��_���������(3�1�P1��1�07�h7��<��<�0B� C�XC��I�pJ��J�L��Q��R��c+�����`2��1�H2�h]2��������������*�3�h]7�������������P#�=��p4���������11�P1�h]A��������������*�B�pA�����������1�����XeA�2�`���������2�`k��k��o��x��,��4���|p}�4�@��_��5��5��t�C$P6��|p}p6�@��_�D�ʔ������@��_����������8�07�h7��<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T�h]P��������������*�Q�h]V�������������P#�\��pR���������-07�h7�`��������(8�j�0j�(3�0:���|p}P:�@��_�;�0;��h�!�;��|p}�;�@��_�^���������@��_����������U��<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T��Y��Z�h]l�������������( �q�h]t�������������P#�z��pr���������0�<��<�`���������=��S��8��?���|p}�?�@��_��@��@��@� -PA��|p}pA�@��_�|�)�������@��_����������M�0B� C�XC��I�pJ��J�L��Q��R��R�h]�������������������xi�����������B��l��������������0B�hB�C��C�h]��������������8 ���h]���������������*���`o����������& C�XC��l�������������������B��B�xi����������XD�/�/��p����������-�C�(D�`���������D�L�(>�G���|p} G�@��_��G�H� H��H��|p}�H�@��_���t�������@��_����������I�pJ��J�h]N����������������P�xiP����������I� OlP��������������I��I�PJ�hK�h]W�������������8 �^�h]a��������������*�b�`o_���������&pJ��J�xie���������PK��/�`oc���������&�J� K��lQ�����������������J�@J�`fG��K�h]~��������������*��xi�����������L��/��p����������-L�PL�`�������� M��S�(>�(O���|p}HO�@��_�P�(P�HP��P��|p}�P�@��_����������@��_����������Q��R��R�h]�������������������xi����������R� Ol���������������Q��Q�xR�S�h]�������������8 � �h]��������������*��`o���������&�R��R��l�����������������(R�hR�`f��HS��h����hgz��L��L��S�����hg��pD��D��S�����h]3�������������( �:�h]=�������������P#�C��p;���������0(T�`T�`�������� U��h��8�(W���|p}HW�@��_�X�(X�HX��X��|p}�X�@��_�E�ۓ������@��_���������Xc��Y��Z��Z��`�0a��a�`g�h]U����������������Y�xiY���������Z��lY��������������Y��Y�xZ�[�h]e����������������n�h]q��������������*�r�`oo���������&�Z��Z��lZ�����������������(Z�hZ�xix����������[�/0��pt���������-H[��[�`��������p\��a��U�x^���|p}�^�@��_�X_�x_��_�`��|p}8`�@��_���2�������@��_����������`�0a�h]��������������(�!�h]$��������������*�%�^"����������`�0a�����Xe�ha�h]<��������������*�=�xiB���������8b�0��p>���������-�a�b�`���������b�0h��U��d���|p}e�@��_��e��e�f��f��|p}�f�@��_�E�ѓ������@��_���������`g�h]���������������(���xiÓ���������g�0�^����������`g��g�����Xe���g��h����hg8�Pb��b�Hh�����hgQ��[�(\�Xh������<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T��Y��Z��Z��`�0a��a�`g��h����hg/��T��T��i�����hgh� =�`=��i�����f���0�07�h7��<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T��Y��Z��Z��`�0a��a�`g�l�m�@m�Ho�pp�`q��q�s��s��s��h����hgL��7��7�Pk�����`�������k��o�h]��������������ހ�h]���������������� �xi ����������l��l �������������l�Pl��l�xm�h]����������������!�h]$��������������*�%�`o"���������&m�@m��l ������������������l��l�h]%�������������hn�&�ha��n�(3�HC x��ހ &�(��p��� � �H� �0#��%��*�Hn��r� ��h]����������������hn�����^�������������Ho��m�����Xe�����o�`.�����0p��s�h]2���������������8�h];����������������=�xi=����������p��l=�������������pp��p�@q��q�h]I�������������8 �P�h]S��������������*�T�`oQ���������&`q��q��l>������������������p�0q�h]T��������������r�U�ha.�hr�(3�HC x���� -U�h]�����������������r�����^�������������s�r�����Xe����@s�h]a�������������hn�i�h]n��������������r�t��pj���������-�s��s��nj���������5t�f~��0�h]��������������hn���07�h7��<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T��Y��Z��Z��`�0a��a�`g�l�m�@m�Ho�pp�`q��q�s��s��s��t�xw��w�xi���������� w�/0��p����������-�t��v�h]���������������(���h]”�������������*�Ô^����������xw��w�����Xe���w��h����hg��8w�8x�Px�����hg]�Xt��t�`x�����1�P1��1�07�h7��<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T��Y��Z��Z��`�0a��a�`g�l�m�@m�Ho�pp�`q��q�1�P1��1�07�h7��<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T��Y��Z��Z��`�0a��a�`g�l�m�@m�Ho�pp�`q��q�s��s��s��t�xw��w���H��`�����p����������������������(������H��8������������x�h������ �X���p �� -�� ������� ��P���� �X���p ��!��!�H"��"��"��#�P%��(�`*�+�n�hr�1�P1��1�07�h7��<��<�0B� C�XC��I�pJ��J�L��Q��R��R�(T�`T��Y��Z��Z��`�0a��a�`g�l�m�@m�Ho�pp�`q��q�s��s��s��t�xw��w�耒���8��p�����`�������x�����(����@��������H�����ț�������袒 ���������঒Ч�`Д����`����h]Ԕ������������H��הxiڔ��������Ѐ��h]ڔ������������@��ܔhaД耒x��HC x��H�� ܔh]����������������@������^�����������������������Xe�������x�������|p}؃�@��_�������؄� X���|p}x��@��_�D�!�������@��_���������p��8��p�����`�������x�����(����@��������h]E��������������*�F�h]I����������������R�h]U��������������(�b�`oS���������&p�����xie���������P�� 0�`oc���������&��� ��^G���������8��h������XeE�����c@�����������Ј����h]h��������������*�i�h]m���������������t��pj���������1`�����h]x��������������*�y�px����������������Xex�H��`�������������0�������|p}��@��_�،����������|p}���@��_�{�!�������@��_���������8��x�����(����@��������h]���������������*���h]�������������������p����������-x�����h]�������������������xi��������������l��������������(��`�������h]���������������*����l���������������������菒xi����������ؐ�/(0��p����������-P�����`o����������莒���`�����������ؙ�p�������|p}���@��_����������`���|p}���@��_����������@��_���������@��������h]ƕ������������@��ɕxiɕ�����������X�lɕ������������@��x��xiՕ��������0��00��pѕ��������-�����h]��������������@����xi�������������]^�����������������X������`o����������&������Xe����h]�������������@�� �xi ������������^ -�������������蘒�������`o ���������&���蘒Xe�0��hg•H�������������h����hg��0��p��������h]��������������@����xi�������������X�l��������������H�����xi����������8��80��p����������0Ț���h]��������������@����h]�������������������xi����������0�� Ol��������������ț������(��h]Ö������������8 �ʖh]͖�������������(�ږ`o˖��������&�������l������������������H�����`o����������&���h��`f�����`��������`��裒���`��x��h����|p}���@��_�H��h��������|p}(��@��_���n�������@��_���������袒 ���������঒Ч�h]��������������8 ���h]���������������(��^�����������袒 ���������`o����������&袒 ��Xe��X��h]�����������������xi���������h���l���������������8��Ф����h] �������������8 �'��l�����������������������xi-������������/@0��p)���������-(�����h]@�������������8 �G�p@����������������Xe>�@���h����hg�ȥ�����������h]V����������������X�xiX���������H�� OlX�������������঒�����Ч�h]_�������������8 �f��lY�����������������`�����`fO���hg��P����������HC x��h)� ����h]�����������������������ha�������x��h]������������������������v͌��������^�������������H���������Xe��������t͌�����"h)�x�����@��_����������͌0����"����Ȋ�(�������������(�� �����xix������P��X.�����X.��|p}��@��_�Э���������p��h���|p}���@��_�����������@��_���������H -����k�P� -��:-��� p��v�= ��&�(5��Ȱ����h��HC h��� ��������HC h��H -��������HC h��� -�������� Ȱ���h]������������������HC h�� ����X��8��б�h]������������������`f�����HC h��X.�����h]����������������豒����ha����0��h��h]����������������豒�����v����������^�����������������������Xe����貒�t������"X.�h��H���@��_�೒೒����� ��P��$����xi������H���z��赒�z��|p}Œ @��_�ȶ�趒8��!!�ϒ h������|p}���@��_�їD�������@��_���������xɒ���z��dH -����k�P� -���:-�� ����*��8���’��I� h��v�= ���&�(5��������������������@�����`’Ò�Ē�ƒ0Ȓ�ȒPϒ�͒ؿ��’�ĒhȒHC `��� ��������HC `��H -��������HC `��� -�������� ���֗h]җ���������������֗HC `�� ������� ���X���������Òxǒ�Вh]ޗ����������������غ����h]��������������������lޗ�������������������Ⱥ�Xeޗ0��h]�������������������xi������������X�l�����������������ػ�xi������������H0��p���������- ��`��xi�����������(2�`f�輒�h����hg�����0��H������`!�����н����h]%������������� �)�h],����������������0�xi0���������x���l0���������������H��ྒ��xi<���������0��P0��l1��������������������о�h]=����������������>�ha!����`��HC `�� �>�h]�����������������������^�������������@��H������Xe����x��`D�����(���ÒhasRoot]!�0����Ih]H�������������8��O�h]S����������������W�xi\���������’/X0��pX���������-������h]c��������������’d�haD�`’`��HC `��8��d�h]�����������������’����^�������������Ò ’����Xe����8Ò`j������Ò`ǒh]n����������������q�xiu���������XĒ`0�xit����������Ē��h0�h]u��������������ƒv�haj��Ē`��8���’��I� h��v�= ���&�(5@��ϒƸ‰����ƒz��dH -����k�P� -���:-�� ����*��Ќ��Ȓ���nHC `�����v�h]�����������������ƒ����^��������������ƒpĒ����Xe����ǒ`|������ǒXɒh]��������������Ќ���xi�����������Wh]���������������Ȓ��ha|�0Ȓ`��HC `��Ќ���h]�����������������Ȓ����^��������������ȒȒ����Xe����ɒ`��˒��|p} ˒@��_��˒̒ ̒ �̒�|p}�̒@��_�����������@��_���������HӒ�͒8В(ђ�ђPג�גxؒpْߒ8��p��8��h]��������������@���h]�������������������xi���������� ΒX�l���������������͒�͒xi�����������Βp0�`o����������'8ΒxΒ`������Hϒ�Вh]���������������ϒ��ha��PϒxɒHC `��@������ؿ��’�ĒhȒ�ϒh]�����������������ϒ����^�������������8В�Β����Xe����pВ�c�������Ғϒ�ђhҒh]���������������ϒ��xi�����������ђx0��p����������2(ђ`ђh]���������������ϒ˜p������������ђ����Xe�� Ғ`���������ҒXْ��xɒ�Ԓ��|p}�Ԓ@��_��Ւ�Ւ�Ւp֒�|p}�֒@��_�Ę��������@��_���������0��Pג�גxؒpْߒ8��p��8��h]̘���������������Иh]Ә���������������טxiט���������ג�lט�������������ג�גXؒxؒh]���������������ϒ���lؘ����������������ؒHؒ^ј��������Pג�ؒ����Xeْ̘h]�������������������xi�����������ْ/�0��p����������-pْ�ْ`��������xڒ8��HӒ�ܒ��|p}�ܒ@��_�`ݒ�ݒ�ݒ ޒ�|p}@ޒ@��_��W�������@��_���������0��ߒ8��p��h]��������������Ȓ��n���������5ߒ`���������ߒ������ڒ�����|p}���@��_����������X���|p}x��@��_� �O�������@��_���������8��p��h],��������������ƒ/�h]2��������������ϒ3�^0���������8��p������Xe,����f?��В�h����hg �8ߒhߒ(������`��������������HӒ�����|p}���@��_����������X���|p}x��@��_�]���������@��_���������8��h]���������������Ȓ��xi����������P�^����������8��p������Xe�����hg���ْ0ڒh�����������������������@�����`’Ò�Ē�ƒ0Ȓ�ȒPϒ�͒8В(ђ�ђPג�גxؒpْߒ8��p��8��@��H��0��h��@��x��h]Ù�������������ƒƙxi̙������������0�xi˙��������������0��pǙ��������-@�����h]ܙ�������������’��xi�������������`�xi�������������(2�rܙ��������H��������`fՙ���h����hg����P��h������p�����X���������Òxǒ�Вx������h]���������������’�h]��������������ƒ�xi �������������0��p���������-h�����`o���������0�����//] !�h����sxi������������p��`f�����h����hg��(�����������h]-����������������1�xi1������������ Ol1�������������@��x����0��x��xi8���������`���0�h];��������������ƒ>��l2����������������������`f&����HC `���z�����h]���������������� ������ha����h��`��h]���������������� �������v����������^�����������������������Xe���� ���t������"�z�`��@���@��_�����(���������&����xiJ� ��������i�� ���i��|p}�� @��_��� ���i�C<0� �������|p}���@��_�e�ԣ������@��_����������%��l�����v:�H -����k�P� -0��:-��H!P��S_���z��d� ���v�= h��&�(5h��������0��H�����(������������P�p���h�� �0 -�0����� �HC ���� ��������HC ���H -��������HC ���� -�������� ���j��0��o�h]f�������������h��j�h]l����������������o�HC ��� ����HC ����������h������(�8�� �藓h]{����������������~�h]���������������ٔ���p���������-H������n���������5���h]��������������������n����������8(��xi�������������`�p����������-`������n����������5���`o���������������h]��������������xٔš������xiÚ�������� ���s�hm���������������������s����������8��Xe������h����hgw�H������������h]������������������`���h]��������������h�����l�������������������P�Xe����`�����p� �h]�������������H! �xi������������0�h]�������������P��ha������HC ���H!�h]����������������P�����^���������������������Xe������`���������h]�����������������xi ������������0�xi���������8����0�h] �������������(�!�ha�P����P����*&{� -����v:�� ���v�= h��&�(5@�� �Ƹ‰H -����k�P� -0��:-��H!P��S_���(�z��dЌ� ����n�����F��� HC ������!�h]����������������(�����^�������������p������Xe������`'�����X���h]+�������������Ќ�7�xi:����������Wh]:������������� �>�ha'������HC ���Ќ�>�h]���������������� �����^�������������h�������Xe������`D�����P �h]H�������������@�I�h]H�������������� �I�haD�� ����HC ���@�H�h]T����������������W�h]\��������������ٔe����0��H�����(������������P�p���h�� �0 -�h -� �� �`���0�p�0�0�h�H�x����!��!��#�x$��pX���������-0 -�h -��nX���������5� �h]i����������������l�xil���������� �X�ll������������� �P �xiv��������� ��0��pt���������0� �� �`of���������� � �h]{����������������~�xi~����������X�l~�������������� �� �h]��������������h����xi������������X�l��������������`����p����������1 ���`ox���������` � �`���������������h#��g��i��������|p}�@��_�����`e�!���|p}��@��_���`�������@��_����������%�p�0�0�h�H�x����!��!��#�x$��b��b�Hc��c� d�h]�������������������xi������������X�l��������������p���h]��������������h����xi������������X�l��������������0�h��p����������-����h]�����������������Ûh]ț������������h��̛�pě��������-0�h�`o��������������xiݛ��������P��`f֛ ��h����hg����h�������`��������h]�������������������h]�������������������xi������������X�l��������������H���xi���������8��0�`o����������'���h]����������������ha����h�HC ����������0����� ���h�h]����������������������^�������������x�P�����Xe������` -�����`�X�h]�������������P���xi"������������0�xi!�������������0�h]"���������������#�ha -�0�h�HC ���P��#�h]����������������������^���������������������Xe�����h����|p} �@��_��� � �� ��|p}� �@��_�/�Š������@��_����������%��!��!��#�x$�h]0�������������� �1�h]4�������������h��8�xi8��������� "�X�l8��������������!��!�xiB����������"��0�`o@���������'8"�x"�^2����������!��"�����Xe0�#��c+�����%�P#�8$��$�h]E�������������� �F�xiJ��������� $��0��pG���������2�#��#�h]O�������������� �P�pO����������x$�����XeO��$�`��������X%��%��)�hb����`'���|p}�'�@��_�@(�`(�`a�!)��|p} )�@��_�R�Š������@��_���������8:� �@,�*��h*�X+��+��,��2��7��7�@>�D��D� E��F�L�PL�@M��R� ,�`\�����(*��,�h]b������������� �f�h]i�������������h��m�xim����������*��lm�������������h*��*�8+�X+�h]y�������������� �z��ln������������������*�(+�h]z�������������@,�{�ha\��+��%�HC �%� �{�^��������������+��+�����Xe�����,�h]��������������@,���xi����������X-�/�0��p����������-�,�(-�`���������-�@9��%�0���|p} 0�@��_��0�1� 1��1��|p}�1�@��_�����������@��_����������3��2��7��7�h]6������������� �B��n5���������5�2�`��������03�9�9�x.�85���|p}X5�@��_�6�86�X6��6��|p}�6�@��_�D��������@��_����������7��7�h]R�������������P�W�h]Z�������������� �[�xi^���������X8��0�`o\���������&�7�(8�^X����������7�p8�����XeR��8�fm�h#��h����hg1��2��2�09�����`���������9�XF�0a��%��;���|p}�;�@��_��<��<��<�`=��|p}�=�@��_�����������@��_���������H�@>�D��D� E��F�L�PL�@M��R�Y�8Y��^�`�P`�h]������������������xi�����������>�1�xi�����������>���1��p����������-@>��>�`���������?��D�0F�8:��A���|p}�A�@��_�xB��B��B�8C��|p}XC�@��_�����������@��_���������D��D� E�h]V������������� �b�xie���������P�^c���������D�PD�����XeV��D�h]x�����������������h]��������������� ���xi�����������E�1�`o����������& E�XE�^�����������D��E�����Xex��E��h����hg��?�H?�HF�����h]������������������xi�����������F�1��p����������2�F��F�`���������G��`�8:��I���|p}�I�@��_�xJ��J��J� 8K��|p}XK�@��_�����������@��_����������Z�L�PL�@M��R�Y�8Y��^�`�P`�h]��������������@,��h]���������������� -�xi -����������L��l -�������������PL��L� M�@M�h]�����������������l ������������������L�M��p���������-L�xM�`��������XN��Y�H�`P���|p}�P�@��_�@Q�`Q��Q�R��|p} R�@��_����������@��_����������T��R�Y�8Y�h]5���������������;�p5�����������R�����xiA����������S� 1�xi@����������S���(1��p<���������-S��S�`��������xT��Y��N��V���|p}�V�@��_�`W��W��W� X��|p}@X�@��_�D�ܟ������@��_���������Y�8Y�h]ğ������������(�ǟh]ʟ������������� �˟^ȟ��������Y�8Y�����XeğpY��h����hg/��S�0T��Y�����`��������`Z�`��`�H�h\���|p}�\�@��_�H]�h]��]�^��|p}(^�@��_�����������@��_����������^�`�P`�h]g���������������m�xiq���������P_�01�xip����������_���81�^n����������^�h_�����Xeg��_�h]��������������(���h]������������������^����������`�P`�����Xe���`�hg���M�N�Z������h����hg��G�HG� a�����h*�X+��+��,��2��7��7�@>�D��D� E��F�L�PL�@M��R�Y�8Y��^�`�P`�hg��p-��-�p9�����h]Ѡ������������P�֠h]۠������������(�ޠ�pנ��������-�b��b�h]��������������(���h]������������������^����������Hc��c�����Xe���c�h]�������������(��xi����������d�@1�xi����������d���H1��p���������- d��d�h]#�������������(�&�p�0�0�h�H�x����!��!��#�x$��b��b�Hc��c� d�(e�hf�h��h�(i�h])�������������h��-�xi-����������f�X�l-�������������hf��f�^'���������(e��f�����Xe#�(g��h����hg ��d�xg��g�����hg͠c�d��g�����h]C�������������h��G�xiG���������hh� OlG�������������h�8h��h��h�(i�h]N�������������P�S�h]U�������������(�X��lH������������������h��h�`f<�`i����0��H�����(������������P�p���h�� �0 -�h -� �� �`���0�p�0�0�h�H�x����!��!��#�x$��b��b�Hc��c� d�(e�hf�h��h�(i��t�u�w��w�(}�~���8��p�����Ȑ����Б�h������8��`��������0l��v����З����8n���|p}Xn�@��_�o�8o�p��!�o��|p}�o�@��_�f�У������@��_����������p��t�u�w��w�(}�~���8��p�����Ȑ����Б�h�������l�Hr���|p}hr�@��_�(s�Hs�hs� �s��|p}t�@��_�r�{�������@��_��������� y��t�u�w��w�(}�~���8��p�����Ȑ����Б�h]s�������������� �t�h]w�������������h��{�xi{���������hu�X�l{�������������u�8u�xi�����������u�P1�`o����������'�u��u�^u����������t�v�����Xes�Hv��cn�����Xx��v��w�@x�h]��������������� ���xi����������hw�X1��p����������2w�8w�h]��������������� ���p������������w�����Xe���w�`���������x�8���p��z���|p}�z�@��_��{��{��{� H|��|p}h|�@��_���{�������@��_������������(}�~���8��p�����Ȑ����Б�h]��������������h����xi�����������}��l��������������(}�`}��}�~�h]��������������� ����l�������������������}��}�xi�����������~�/`1��p����������-P~��~�`��������x���� y������|p}���@��_�`�������� ���|p}@��@��_�á��������@��_���������0����8��p��h]^������������� �j��n]���������5��`������������������������|p}؆�@��_�������؇�X���|p}x��@��_�l���������@��_���������8��p��h]z�������������P��h]��������������� ���xi����������؉�h1�`o����������&p�����^����������8���������Xez�0��f���v��h����hgY�8��h���������h]��������������(���xiĢ��������X��p1�xiâ�������������x1��p����������-���p��`��������@�������� y�H����|p}h��@��_�(��H��h��菓�|p}��@��_�Ǣs�������@��_���������Ȑ����Б�h]=������������� �I�xiL���������P�^J���������Ȑ�������Xe=�0��h]]�������������(�`�h]c�������������� �d�xig���������8���1�`oe���������&Б���^a������������P������Xe]�����h����hg���������������hg���~�0�������h]��������������(���xi����������Г��1�xi���������������1��p����������-h��蓓xi��������������`f��p���h����hg��0�����Д�����h]��������������h����xi����������x�� Ol����������������H�������8��h]��������������P�ãh]ţ������������(�ȣ�t�u�w��w�(}�~���8��p�����Ȑ����Б�h������8���l���������������������Е�`f��x��hgP�`����k�����HC ����i�����h]����������������������ha����`�����h]�����������������������vT���������^�����������������������Xe�������tT� ����"�i��������@��_����� ��T�P�����(����xiڣ����x���(�����(��|p}��� -@��_���������!x�� ��� ���|p}؝�@��_���N�������@��_����������������0�@��V�W!H -����k�P� -(��:-��83�P��bF:,���z��d� ���v�= (��&�(5(��������(��袓���������P��p��Ȫ�h��ج����@�����ഓ ��0�������HC ���� ��������HC ���H -��������HC ���� -�������� �����h]��������������(����HC ��� ����H�� -���С�(��8���������h]��������������� -���(��h] �������������(����l�����������������������Xe�`��`���������h]��������������0�"�xi&�������������1�xi%���������Т����1�h]&�������������@��'�ha�袓���HC ����0�'�h]����������������@������^�����������������������Xe�������`-�����p�� ��h]1�������������83�:�xi=���������ओ�1�h]=�������������P��>�ha-�������HC ���83�>�h]����������������P������^�����������������������Xe����Х�`D�����������h]H����������������K�xiO�������������1�xiN���������8�����1�h]O�������������(��P�haD�P�����83�P��bF:,�0�@��V�W!� ���v�= (��&�(5@����Ƹ‰ H -����k�P� -(��:-�����(��z��dЌ� �����nX;�0���Z�FHC ������P�h]����������������(������^�������������p��������Xe�������`V�����X�����h]Z�������������Ќ�f�xii����������Wh]i������������� ��m�haV�Ȫ����HC ���Ќ�m�h]���������������� ������^�������������h���������Xe�������`������P��H��h]��������������X;���xi��������������1�h]��������������0����ha��ج����HC ���X;��� �� ��0���������x��h]����������������0������^�����������������������Xe���������������|p}��@��_�а����������|p}���@��_��Ө������@��_���������������ഓе����h] �������������@� �h]�������������(���xi�����������X�l����������������ಓxi�������������1�`o���������'(��h��`�����8��h��h]�����������������ha�@��h��HC ���@��h]�����������������������^�������������ഓ�������Xe�������c�����(�����P����h] ����������������!�xi%���������8���1��p"���������2е���h]*����������������+�p*�����������������Xe*�ȶ�`��������p���������˓�ӓ`�����x����|p}���@��_�X��x���ݓ!���|p}8��@��_�-�Ө������@��_������������ �X��*�����p�������ē�ɓʓ�˓�ѓ�ғ�ғ(ԓ�ٓ�ړ�ړ�ۓ8��`5�����@�����h];������������� �?�h]B�������������(��F�xiF���������輓�lF�������������������P��p��h]R����������������S��lG�������������������@��h]S�������������X��T�ha5������HC ��� �T�^����������������������Xe�������h]`�������������X��d�xii���������p��/�1��pe���������-��@��`����������X˓�˓���“��|p}8“@��_��“Ó8Ó�Ó�|p}�Ó@��_�r�h�������@��_����������œ�ē�ɓʓh]������������� ����n���������5�ē`��������Hœ˓0˓���PǓ��|p}pǓ@��_�0ȓPȓpȓ�ȓ�|p}ɓ@��_��N�������@��_����������ɓʓh]!�������������P��*�h]-����������������.�xi1���������pʓ�1�`o/���������&ʓ@ʓ^+����������ɓ�ʓ����Xe!��ʓf>�����h����hg��ēœH˓�����eW�����h����hg\����ȿ��˓����h]s�������������(��v�xi|���������H̓�1�xi{����������̓���1��pw���������-�˓`̓`��������0͓pғ�ӓ���8ϓ��|p}Xϓ@��_�Г8ГXГ�Г�|p}�Г@��_���������@��_����������ѓ�ғ�ғh]�������������� ����xi����������P�^�����������ѓ�ѓ����Xe�� ғh]�������������(�� �h]�����������������xi���������(ӓ�1�`o���������&�ғ�ғ^ ����������ғ@ӓ����Xe��ӓ�h����hgo��̓�̓�ӓ����h]'�������������X��+�xi0����������ԓ.2��p,���������-(ԓ`ԓ`��������0Փ�ݓ���8ד��|p}Xד@��_�ؓ8ؓXؓ�ؓ�|p}�ؓ@��_�9��������@��_����������ٓ�ړ�ړ�ۓ�ܓh]��������������@����xi���������� ړ2�xi����������hړ��2��p����������-�ٓ8ړh]��������������@����h]�������������������^�����������ړ�ړ����Xe��0ۓh]̧������������0��קxiܧ��������ܓ2��pا��������-�ۓ�ۓ�nا��������5ܓh]��������������0����xi�����������ܓ 2�^�����������ܓ�ܓ����Xe��ݓ�h����hgȧXܓXݓpݓ����hg���ړ�ۓ�ݓ�������p�������ē�ɓʓ�˓�ѓ�ғ�ғ(ԓ�ٓ�ړ�ړ�ۓ�ܓ�ޓ���h] �������������@���xi���������Pߓ(2�xi����������ߓ��02��p���������-�ޓhߓ�n���������5�ߓ`��������h�������p����|p}���@��_�P��p��������|p}0��@��_��ͨ������@��_������������h]��������������0����xiè��������X��82�xi¨�������������@2�^�������������p������Xe������h����hg��ߓ �� ������hg#��ԓ�ԓ0������������(��袓���������P��p��Ȫ�h��ج����@�����ഓе���������������������� ��X�����������h]ݨ������������@����xi������������H2�xi����������H����P2��p����������-�����h]��������������(����xi�����������X2�xi���������P����`2��p����������-��� ��`o����������`��h��h]O�������������0��Z�xi_���������P��h2��p[���������-��� ��`o������������h��h]��������������0����xi����������P��p2��p����������-��� ��h]Ω������������@��֩h]۩������������(��ީxi����������H��x2�`oߩ��������'������pש��������-���`��`o©��������h�����h]��������������@����h]��������������P���xi�������������2�`o���������&X������p����������- �����`o���������������`oa������������X��`�������� ��������(����|p}H��@��_���(��H������|p}���@��_� �$�������@��_���������xi�������������`f�����h����hg٨������������������С�(��8��������������h]0�������������(��4�xi4���������8�� Ol4���������������������������h];�������������@��C�h]E�������������(��H��l5�����������������P�����`f)�0��HC ����(�����h]�����������������������ha����������h]������������������������v����������^�������������@��x������Xe��������t������"�(����p���@��_������������H����*����xiT����������������|p}���@��_����������@�� ��� ��|p}`��@��_�k�Z�������@��_����������H -h���k�P� -���:-���  ��v�= 8����������x��H����� ��� -�p �� �HC ��� ��������HC ��H -��������HC ��� -��������8�x��v�h]l����������������v�HC ��8�������h �� -� �h]�������������������xi�������������p����������-H�����h]��������������������n����������8���xi����������������p����������-(�X��n����������5��`o���������������`����������h -�������|p}��@��_�������@��|p}`�@��_���1�������@��_��������� ��h]˪������������xٔԪh�� ����@�ު��x�����H�xiު����������h��xiު����������h��h]���������������� ��n���������8�xi ������������xi ������������ �H�n����������� �`oު��������&�� �`o���������&` �x�hmǪ�������� �X������s����������� �Xe��8 -��h����hg~��P�� -�����h]=���������������D� �( �p �xiE���������X �`�h]J����������������T��l=������������������ -�� -�`f6�� �HC ��������h]���������������� �����ha����` ���h]���������������� ������v\���������^�������������� �� �����Xe���� ��t\�����"��������@��_��� �\����� �,����Ȋ�(�������������(�� ����� ��ǔ�Ȕ�ɔ@ʔ�ʔxi`��������������|p}�@� @��_�����p���dHF� 0�pƔ�|p}p�@��_�u�`� - ������@��_���������p�����������E�n�H -x��k�P� -��:-�� �� �*��� 0�v�= ��&�(5����X���P���������� � !�H"�#�(%�P&��&��+���� �@#��&�HC (�� ��������HC (�H -��������HC (�� -�������� ��z�h]v���������������z�HC (� �����Ĕ#P�h�8�h��!��%�5�h]����������������������h]�������������������l������������������X���Xe����`��������x�h]�������������������� ��h� ���xi����������P���xi������������� �h���������xi�������������xi����������P���� ���������xi������������p�xi������������������������xi«��������x��xiǫ�����������H�����������xi˫��������0�h�xiѫ��������x���H�����������h� ����� j����������������h]ԫ��������������իha��P�(�HC (���իh]����������������������^��������������������Xe����(�h]߫����������������xi������������X�l������������������xi�������������2��p����������-�P�h]�����������������`f�����h����hg۫���(�����`��������!�h] ������������� ��h]����������������xi���������X��l���������������(�����xi#��������� ��2��l�����������������p���h]$�������������� �%�ha�� �(�HC (� �%�h]����������������� �����^������������� !�( �����Xe����X!�`+�����"��%�h]/��������������E9�h]=�������������� �A�xiF����������"�/�2��pB���������-H"��"�h]M��������������$�N�ha+�#�(�Ќ��=����n @�Ƹ‰ 83��9�bF:, ���������E�$��n�� 0�v�= ��&�(5H -x��k�P� -��:-�� �� �*��H!�&��S_�0��6�V�W!����;�z��d -HC (��EN�h]�����������������$�����^�������������(%��"�����Xe����`%�`T�����&�h]X�������������H!]�h]X��������������&�]�haT�P&�(�HC (�H!X�h]g��������������$�q�`��������p'�P-�8.�(�x)���|p}�)�@��_�X*�x*��*�+��|p}8+�@��_�s���������@��_����������+�h-�h]{���������������~�xi~���������`,���l~��������������+�0,�xi�����������,�`�^����������x,��,�����Xe{�-�h]���������������&���xi�����������-��2�^����������h-��-�����Xe���-���X���P���������� � !�H"�#�(%�P&��&��+�h-�(4�X6�@7�89��9��;�0<��=�(>�P?��@�8D��E��F��K�L�`���������/��4�(��1���|p}�1�@��_��2��2��2�H3��|p}h3�@��_�����������@��_���������(4�h]���������������&���xi�����������4��2�^����������(4�`4�����Xe���4�hgc��&�('�X/�����`Ĭ�����5��7�h]Ȭ�������������0�ЬxiԬ���������5��2�xiӬ��������@6����2�h]Ԭ�������������6�լhaĬX6�(�HC (��0�լ��� �@#��&��6�p9��;��=��@�h]�����������������6�����^�������������@7�6�����Xe����x7�P�h�8�h��!��%�5�@5�h8�x:��<��>��D��K���XĔ`۬�����8�`:�h]߬������������83���xi���������� 9��2�h]���������������9���ha۬89�(�HC (�83���h]�����������������9�����^��������������9��8�����Xe����:�`�������:��<�h]�������������������xi����������0;��2�xi����������x;����2�h]���������������;���ha���;�(�HC (������h]�����������������;�����^�������������0<�H;�����Xe����h<�`�����=��>�h]�������������Ќ��xi����������Wh]��������������=��ha��=�(�HC (�Ќ��h]�����������������=�����^�������������(>�X=�����Xe����`>�`!�����?��D�h]%�������������@�&�h])���������������-�xi-����������?�X�l-�������������P?��?�xi7���������@@��2�`o5���������'�?�@�h]7��������������C�8�ha!��@�(�83��9�bF:, @��C�Ƹ‰ ��&�(5 �� �*��Ќ��=����n ���������E�$��n�� 0�v�= �0��6�V�W!H -x��k�P� -��:-��H!�&��S_����;�z��d -X;�F��Z�F HC (�@�8�h]�����������������C�����^�������������8D�X@�����Xe����pD�`������ E�hG�h]��������������X;�ĭxiǭ���������E��2�h]ǭ������������F�ȭha���E�(�HC (�X;� ȭpƔ��� �@#��&��6�p9��;��=��@��E�h]����������������F�����^��������������F�`E�����Xe����G�(�I���|p}0I�@��_��I�J��{�!�J��|p}�J�@��_�����������@��_����������M��K�L��L��Q�0R� S�T��Y��^�_��`��f��g��g�8i��n��c������(M�PL�M�h]���������������C���h]���������������&����p����������2�K�L�h]���������������C���p������������L�����Xe���L�`��������pM�T��`�i�p{��G�xO���|p}�O�@��_�XP�xP��r�!Q��|p}8Q�@��_�����������@��_����������u��Q�0R� S�T��Y��^�_��`��f��g��g�8i��n��o�p��p�h]�������������� � �h]����������������xi����������R��l�������������0R�hR�S� S�h]��������������C���l������������������R��R�^ ����������Q�XS�����Xe��S�h],�������������� �0�xi5����������T�/�2��p1���������-T�PT�`�������� U�h`��`��M�(W���|p}HW�@��_�X�(X�HX��X��|p}�X�@��_�>�4�������@��_����������Z��Y��^�_�h]Ӯ�������������=�߮�nҮ��������5�Y�`��������XZ�(`�@`��U�`\���|p}�\�@��_�@]�`]��]�^��|p} ^�@��_����������@��_����������^�_�h]���������������9���h]���������������C���xi�����������_��2�`o����������&_�P_�^�����������^��_�����Xe���_�f -��K��h����hgή�Y�Z�X`������e#��K��h����hg(��T��T��`�����h]?��������������;�B�xiH���������Xa��2�xiG����������a���3��pC���������-�`�pa�`��������@b��g��h��M�Hd���|p}hd�@��_�(e�He�he��e��|p}f�@��_�K���������@��_����������f��g��g�h]���������������=�¯xiů��������P�^ï���������f�g�����Xe��0g�h]ԯ�������������;�ׯh]گ�������������C�ۯxiޯ��������8h�3�`oܯ��������&�g�h�^د���������g�Ph�����Xeԯ�h��h����hg;��a��a��h�����h]��������������� ���xi�����������i�.3��p����������-8i�pi�`��������@j��r��M�Hl���|p}hl�@��_�(m�Hm�hm��m��|p}n�@��_��Ͱ������@��_����������n��o�p��p��q�h]^��������������6�f�xil���������0o�3�xik���������xo��� 3��pg���������-�n�Ho�h]y��������������6���h]���������������C���^�����������o�p�����Xey�@p�h]��������������F���xi����������q�(3��p����������-�p��p��n����������5(q�h]��������������F���xið��������r�03�^�����������q��q�����Xe��r��h����hg��hq�hr��r�����hgZ��o��p��r������Q�0R� S�T��Y��^�_��`��f��g��g�8i��n��o�p��p��q��s�z�h]װ�������������6�߰xi����������`t�83�xi�����������t���@3��p����������-�s�xt��n����������5�t�`��������xu�{��M��w���|p}�w�@��_�`x��x��x� y��|p}@y�@��_�����������@��_���������z�h]��������������F���xi����������hz�H3�xi�����������z���P3�^����������z��z�����Xe���z��h����hgӰu�0u�0{�����hg���i��i�@{������K�L��L��Q�0R� S�T��Y��^�_��`��f��g��g�8i��n��o�p��p��q��s�z���X���P���������� � !�H"�#�(%�P&��&��+�h-�(4�X6�@7�89��9��;�0<��=�(>�P?��@�8D��E��F��K�L��L��Q�0R� S�T��Y��^�_��`��f��g��g�8i��n��o�p��p��q��s�z��~�������Ђ���H�����Њ�ؐ������В����h]���������������6���xi����������(�X3�xi����������p���`3��p����������-�~�@�h]ı�������������;�DZxiͱ��������0��h3�xi̱��������x����p3��pȱ��������-��H��`o���������������h]�������������F�&�xi+���������x��x3��p'���������-��H��`oϱ��������Ѐ����h]|�������������F���xi����������x���3��p����������-��H��h]���������������6���h]���������������;���xi����������p���3�`o����������'��@���p����������-Ђ����`o�������������ȃ�h]���������������6�òh]Ȳ�������������9�ѲxiԲ��������脔�3�`oҲ��������&�������pIJ��������-H����`o������������@��`o-���������Ё����`��������H��@��(�P����|p}p��@��_�0��P��p�� ����|p}��@��_�ز��������@��_���������Ќ�Њ�ؐ������В����Ȕ���Ж����������h]���������������;���xi����������8���3�xi����������������3��p����������-Њ�P���n����������5���`��������P����Ȇ�X����|p}x��@��_�8��X��x�� ����|p}��@��_�����������@��_���������ؐ������В����Ȕ���Ж����������h]���������������9��xi ���������@���3��p���������-ؐ���h]��������������$��`o���������X�����h]'���������������*�xi*���������x��p�l*���������������H��h]2���������������5�xi5���������8��h�l5�������������В���h]=���������������A�xiA������������ OlA����������������ȓ�`�����Ȕ�xiH�������������3�h]K��������������;�N��lB�������������������P��^;���������P��������^0������������X������Xe'����h]h���������������k�xik���������x��p�lk���������������H��h]s���������������v�xiv���������8��h�lv�������������Ж���h]~�����������������xi������������� Ol�����������������ȗ�`��������h]���������������9���h]���������������;����l��������������������P��^|���������P���������^q������������H������Xeh����hg��Б����虔�����h����hg��؋���0��������X���P���������� � !�H"�#�(%�P&��&��+�h-�(4�X6�@7�89��9��;�0<��=�(>�P?��@�8D��E��F��K�L��L��Q�0R� S�T��Y��^�_��`��f��g��g�8i��n��o�p��p��q��s�z��~�������Ђ���H�����Њ�ؐ������В����Ȕ���Ж����������x��8�����@��x��p��0��h��0�����ൔ����з������� ��軔ؼ���8�����������p”�”�Ĕ`�����������������(������|p}��@��_�ء����X��!����|p}���@��_���״������@��_���������(��x��8�����@��x��p��0��h��0�����ൔ����з�������h]���������������9�³xidz��������ࣔ�3��pó��������-x�����h]̳�������������$�ֳ`oɳ�����������8��`�����������X��H��p������|p} ��@��_�৔�� ������|p}���@��_�س4�������@��_������������@��x��p��0��h��h]������������������xi����������詔h�l��������������������h]������������������xi������������� Ol��������������@��x����0��x��xi����������`���3�h]���������������6���l�����������������������^�������������������Xe����h]����������������xi���������ج�p�l�������������p�����h]����������������xi������������ Ol�������������0��h���� ��h��xi$���������P���3�h]'��������������;�*��l�����������������������^�������������������Xe����`��������������ع�p�������|p}б�@��_�������в�P���|p}p��@��_�:���������@��_���������0�����ൔ����з�������h]D���������������G�xiG������������h�lG�������������0��h��h]O���������������S�xiS���������X�� OlS����������������(�����ൔ��h]Z��������������9�c�h]e��������������6�m��lT�����������������p�����^M������������P������XeD����h]x���������������{�xi{���������x��p�l{���������������H��h]������������������xi����������8�� Ol��������������з������������h]���������������9���h]���������������;����l������������������P�����^�������������0������Xex����hg��p�����`������h]������������������x��8�����@��x��p��0��h��0�����ൔ����з������� ��軔ؼ���xi��������������l�������������� ��`��h]������������������xi����������P�� Ol��������������軔 �����ؼ���h]´�������������6�ʴh]̴�������������;�ϴ�l������������������h�����^�������������H������Xe�����hg��������������h]���������������9���xi��������������3��p����������08��p��h]������������������xi����������`����l�����������������0��h]����������������xi��������� �� Ol�������������������������p��xi �������������3�h]��������������9��xi���������X���3�`o���������'���(���l�����������������8��x��^����������x���������Xe��”h]+��������������$�5�h]=���������������@�xi@���������Ô��l@��������������”�”xiG����������Ô`�^E���������(ÔhÔ����Xe=��Ô�h����hg'�p”ĔĔ����hgݴ���X”(Ĕ����h]X���������������[�`fQ��Ĕ@ǔP�h�8�h��!��%�5�@5�h8�x:��<��>��D��K���XĔ�ĔHC (��� -����h]�����������������Ŕ����ha����8Ɣ(�h]�����������������Ŕ�����vg���������^��������������Ɣ�Ɣ����Xe�����Ɣ�tg�����"��(���@��_��ǔ�ǔ�ǔg���Xǔ.����xif�����PȔ��xik� �����Ȕ`� ȔhȔ��������xir�#����ɔ�5�:](!� ɔV�~�xi}�&�����ɔ(ɔ�ȔXɔ��������xi��)�����ɔ��xi��,�������ɔʔ��������xi��/�����ʔ�7�xi��2������hʔ�ʔ�������� j5������4�@:�����h]������������˔��ha'�X˔�HC ��7� -��^����������X˔˔����Xe�����˔h]��?���������˔��xi��<�����̔��l��9��������`̔�̔h]��L��������9���xi��I�����͔��l��F�������� ͔X͔h]��O��������9�ŵ^��B�����͔�͔0^��5�����̔Δ2Xe��hΔh]ǵ\���������˔̵�  � ��ph�|h�P��8�X˔`̔ ͔�͔�Δ�ДXєHҔ�Ӕ�Ԕ(Ք�Քxi̵Y����@Д�7�l̵V���������ΔДh]յi��������9�ڵxiڵf����є�7�lڵc���������Д�Дh]��l���������˔��^��_����єXє4^ӵR����XД�є6Xeǵ�єh]��{����80ٔ��platform]0!��Ҕ�-��xi��x�����Ҕ�Ҕl��u����:HҔ�Ҕxi�~����pӔ���p�r����-Ӕ@Ӕh]����������h�xi������0Ԕ� l�����������ӔԔh]!����������9�&�^������HԔ�Ԕ�������Ք�Ք>Xe/� ֔hg���ӔՔp֔o�t ����d����@��_����0��0��Xe�ؔ�t���������� �@��_�ؔؔؔ����HC �� ����h]���� ��������ؔ����^��������Xؔ�֔����h]K���������ؔ����`fK��ؔHC ���������HC �(���������HC �H ���������P�.this_function]�3�Hڔ�s�p"p����x���8�8������ �# -���`�����(�h�(�P�`�`� � -`��������� �@�0}�X��� �p���`� X<�> �A -@D xI �a d�}��9�@:��:��;��>�B��F��H�J�b� e� -(�� (� HL��L��L��M� Q��U�����z�8{��{������@��`��@��ؤ�0�� �-�0.�x.� 0�h0�7�<�XF��V��i� l� -h|� H�� p�� @��蝀������P��p3��3�4�5��@��I� �h���������x������������� ��� -��� @@� Ї�H��� �0n�xn��n��o�@p�0w�{�}��~���� ��� -�M�-�X-��-��.��1�@4�8�:�`<��C� ���Ѝ��������Ȥ�����0����� ��x��p��hԃ hփ -蟐 ��� P�� ੐������>�?�P?��A��C�PE�PM��V�@�����Џ�А�X�������讑0��0����X��������Ƒhϑ�����H�������������( �8 �h� ( � -P#� �(� �*� hn��r�@��p���������h���������������’�ƒ�Ȓ�ϒ@,�������0��h�����P�(� �� ��� �� -X��������(��(��@��P��(�� ��0����� ��h��������0�x�������� ��$��&��6��9� �;� -�=� �C� F� � x - � h0x��� p| -�� �� 9� �˔0ٔxٔ�ٔ� h0x��� p| -�� �� 9� �˔ؔ0ٔxٔ�ٔ diff --git a/Chapter03/working-with-files/asynchronous-file-operations/file.dat b/Chapter03/working-with-files/asynchronous-file-operations/file.dat deleted file mode 100644 index 70f7303..0000000 Binary files a/Chapter03/working-with-files/asynchronous-file-operations/file.dat and /dev/null differ diff --git a/Chapter03/working-with-files/asynchronous-file-operations/log.txt b/Chapter03/working-with-files/asynchronous-file-operations/log.txt deleted file mode 100644 index 18bed12..0000000 --- a/Chapter03/working-with-files/asynchronous-file-operations/log.txt +++ /dev/null @@ -1,22 +0,0 @@ -Wed Jun 08 2016 22:53:26 GMT+0100 (BST) 896961 bytes removed -Wed Jun 08 2016 22:54:14 GMT+0100 (BST) 896961 bytes removed -Wed Jun 08 2016 22:54:25 GMT+0100 (BST) 896961 bytes removed -Wed Jun 08 2016 22:54:30 GMT+0100 (BST) 896961 bytes removed -Wed Jun 08 2016 22:54:36 GMT+0100 (BST) 896961 bytes removed -Wed Jun 08 2016 22:54:41 GMT+0100 (BST) 896961 bytes removed -Wed Jun 08 2016 22:54:59 GMT+0100 (BST) 10000000 bytes removed -Wed Jun 08 2016 22:56:01 GMT+0100 (BST) 100000000 bytes removed -Wed Jun 08 2016 22:57:07 GMT+0100 (BST) 897494 bytes removed -Wed Jun 08 2016 22:57:23 GMT+0100 (BST) 10000000 bytes removed -Wed Jun 08 2016 22:57:32 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 22:57:34 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 22:57:35 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 22:58:21 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 22:59:03 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 23:03:21 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 23:03:56 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 23:04:14 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 23:04:40 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 23:04:45 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 23:50:48 GMT+0100 (BST) 897432 bytes removed -Wed Jun 08 2016 23:50:50 GMT+0100 (BST) 897432 bytes removed diff --git a/Chapter03/working-with-files/asynchronous-file-operations/null-byte-remover-sync-with-progress-dots.js b/Chapter03/working-with-files/asynchronous-file-operations/null-byte-remover-sync-with-progress-dots.js deleted file mode 100644 index cb9dea7..0000000 --- a/Chapter03/working-with-files/asynchronous-file-operations/null-byte-remover-sync-with-progress-dots.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -setInterval(() => process.stdout.write('.'), 10).unref() - -const fs = require('fs') -const path = require('path') -const cwd = process.cwd() -const bytes = fs.readFileSync(path.join(cwd, 'file.dat')) - -const clean = bytes.filter(n => n) -fs.writeFileSync(path.join(cwd, 'clean.dat'), clean) - -fs.appendFileSync( - path.join(cwd, 'log.txt'), - (new Date) + ' ' + (bytes.length - clean.length) + ' bytes removed\n' -) \ No newline at end of file diff --git a/Chapter03/working-with-files/asynchronous-file-operations/null-byte-remover.js b/Chapter03/working-with-files/asynchronous-file-operations/null-byte-remover.js deleted file mode 100644 index 9ffea92..0000000 --- a/Chapter03/working-with-files/asynchronous-file-operations/null-byte-remover.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' - -setInterval(() => process.stdout.write('.'), 10).unref() - -const fs = require('fs') -const path = require('path') -const cwd = process.cwd() - -fs.readFile(path.join(cwd, 'file.dat'), (err, bytes) => { - if (err) { console.error(err); process.exit(1); } - const clean = bytes.filter(n => n) - fs.writeFile(path.join(cwd, 'clean.dat'), clean, (err) => { - if (err) { console.error(err); process.exit(1); } - fs.appendFile( - path.join(cwd, 'log.txt'), - (new Date) + ' ' + (bytes.length - clean.length) + ' bytes removed\n' - ) - }) -}) diff --git a/Chapter03/working-with-files/clean.dat b/Chapter03/working-with-files/clean.dat deleted file mode 100644 index c0c38c9..0000000 --- a/Chapter03/working-with-files/clean.dat +++ /dev/null @@ -1,189 +0,0 @@ -��b�6�d�����%�%����h]k�������������0��2���|p}82@��_��23xc!�3�|p}�3@��_��v�y3��������`@��_�����������9(2h]{�������������|�ha@2  ��|������������������2����^�������������4�4�6�=�>(D`DXFG�LxR8S�S�VW�Wp}05���_�606�6p}�6���_�����h]w������������x��wh] w�������������� wxi w��������85�`�l w�������������45�5�5xiw���������58 �lw����������������P5�5A^w���������46����Xew`6h])w��������������-wxi-w��������07�`�l-w�������������67�7�7`�7xi9w���������7����@ �l.w����������������H7�7�xi@w���������8:H �pHcX �"�0x2�8�Bh]�����������������00;���|p}P;@��_�<0<@b!�<�|p}�<@��_�Iw�y$����`@��_��������������Y���������8p����������� ;Xe��`���������@�D�F�=�>(D`DXFG�LxR8S�S�VW�W�]�^`_�>?(?�|�?��h]Uw��������_���� ��\wxi_w��������>P ^]w���������=�=����XeUw0>h]pw���������������swxivw��������?X �ptw��������0�>�>`���������?@F�X�9�A���|p}�A@��_��B�B�B HC�|p}hC@��_�ywy]����`@��_���������������H��l���������������A������(B�@�����������Ah]���������������B��ha��(D`DXFG�LxR8S�S�VW�Wh]�����������������B����^�������������@B����XeXCh]�����0�������������8h]�w�������������x���wh]�w���������������w����xi�w���������D�`�l�w������������`D�D0EPE�2��h]xi�w���������E����` �l�w������������������D E����^�w������������(D�E����Xe�w�Eh]�w������������x���wxi�w���������F/h �p�w��������-XF�Fh]�w������������x���wxi�w���������G\p �p�w��������-GPG`o�w���������F�G`��������`H��V�W�X�H���l������������� HXH @hJ���|p}�J@��_�HKhK�KL�|p}(L@��_��wy}����`@��_�L��������pN�Mp} M���_�#�������@����_������Q�LxR8S�S�VW�W�k�P� -�pN:-������OR�q � ��Mv�= �OV�q$�O�O8O�P�UXW@X�Yh]�w����������������wxi�w��������PMx �p�w��������-�L M`���������MC pV�V��������HC �IH -����������H�O���|p}P@��_��P�PQ�Q�|p}�Q@��_��w�xO����`@��_����������I��HP�Y�Zh]�����O;���������Q�V�WxR8S�S�V�IS���|0S�S�T�|p}���_�h]wx������������0��zxxizx����������R�����H�lzx������������xR�Rh]�x������������0���xxi�x���������S�G�l�x������������8SpSh]�x���������������xxi�x��������`T ��l�x�������������S0T�T�T0Uxi�x��������U� xi�x��������`U� �l�x����������������xT�Ti^�x���������SxU��������^�x���������R�U����Xewx Vh]�x�������������0���x`f�x�V�h����hg�whM�M�V��������h]�x������������p���xxi�x�����������ł^�x��������WPW����Xe�x�Wh]�x������������� ��yxiy��������PX� ^y���������W X����Xe�xhX�h����hg�w�GH�X��������`��������XY�a(bY�Y����`o����������&�XYXet��9`[���|p}�[@��_�@\`\�\]�|p} ]@��_�%y�y�����`@��_������������������������G�G��X[����������xi������������l���������������[\�]�^`_�a�������������p����������-H\�\�n�����������\h]��������� p"�%h0@2�8�Bh]�y������������0���yxi�y��������H^�H�l�y�������������]^h]�y������������0���yxi�y��������_�G�l�y�������������^�^h]�y���������������yxi�y����������_ ��l�y������������`_�_0`P`�`^������xi�y���������`� xi�y���������`� �l�y�����������������_ `�� ^�y�������� _�`�����^�y��������`^8a����Xe�y�ah]�y������������0���y� `f�y�a�=�>(D`DXFG�LxR8S�S�VW�W�]�^`_�a�����b��l��� ������b�bxihglw?X?Y�����4�4�6�=�>(D`DXFG�LxR8S�S�VW�W�]�^`_�a����0d��l�� ������cd�h����hg%w�8�8�d����8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�����0�h��@������,�x-�x.�8/��4�4�6�=�>(D`DXFG�LxR8S�S�VW�W�]�^`_�al@� ������f�fxiJ� �����g���lJ�� �����@g�g^4�� �����f�g�Xe�hh]x� ������������xi�� �����h��l�h����hgsv�80�x0��h����royShg�p������i����إ������ج�x����`��x��8��ر�H��h����� ����������������8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�إ������ج�x����`��x��8��ر�H��h����� ����������������8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�����0�h��@������,�x-�x.�8/��4�4�6�=�>(D`DXFG�LxR8S�S�VW�W�]�^`_�a�oxpHvw�w@y�zH{|@}�0���@���0���(�P���8���H�H�����`�������@��H���X�0�h]z������������x�� zxiz������������ p/� �p -z��������-�o�oh]z������������x��zxi"z���������p\� �pz��������-xp�p`oz��������8p�p`���������q�(yxy����HC �kp܀����x���s���|p}�s@��_��t�t�thu�|p}�u@��_�+z�z�������`@��_���������h]����������������h]�����q�������������o��`��h]����������Hvw�w@y]�u�5Ouh]���������������o���D����������r�Dh]����������������h]����h]�z������������0���zxi�z���������v�H�l�z������������Hv�vh]�z������������0���z����xi�z��������pw�G�l�z������������w@wh]�z����������������zxi�z����������0x� l�z��������������wx^�z���������wHx����^�z���������v�x����Xe�z�xh]�z������������0���z`f�z@y�h����hgzQ 8qxq�y����hg�p(��h���y����������������x����`���yH~x~Ѐ��ЈȊ؍��h]�z������������� ���zxi�z�����������z� �p�z��������0�z�zh]�z������������0���zxi�z���������{�H�l�z������������H{�{h]�z���������������zxi�z��������p|l ��l�z�������������|@|�|�|@}�|xi�z��������(}����� h]�z������������ ��{Z �l�z�����������������|�|^�z���������{x}����Xe�z�}�h����hg�z{ ~8~����` {�����~� ��h]{�������������0�{xi{���������0y � xi{��������x��� h]{�������������{ha {�x��HC x���0�{h]���������������������^�������������0�H����Xe�����h�`"{�����ȅh]&{�������������83�/{xi2{������������ h]2{��������������3{ha"{��x��0�x�Є@�83���bF:, ��X�0�h�Ȝ� ���&�(5@Y���Ƹ‰��� �����K T�x��*���~�h��n�0 Ќ������np� ���������ب����2�~�pH -����������0��V�W! ��0������� ����v�= ���p���n�H -�Ȥ��k�P� -���:-��(тh���`� -���P�z��d X;���Z�F��������HC x��83�3{h]����������������������^�������������@�X�����Xe��������x�`9{����(���h]={���������������@{xiD{����������� xiC{������������� h]D{������������P�E{ha9{��x��HC x����� E{P��p�����X��P��H��H���؁0���Ќ��h]����������������P�����^�������������0�������Xe����h�`K{�����-����h]O{������������Ќ�[{xi^{���������łh]^{��������������b{haK{��x��HC x��Ќ� -b{h]����������������������^�������������(�X�����Xe����`�`h{�������h]l{������������@Y�m{h]p{��������������t{xit{����������X[�lt{������������P���xi~{��������@�� `o|{��������'Ћ�h]~{��������������{hah{��x��HC x��@Y� {h]����������������������^�������������8�X�����Xe����p�`�{���� �Џh]|������������X;� |xi|���������� -h]|�������������|ha�{��x��HC x��X;� |h]���������������������^�����������������H�`�����Xe��������������x��x����|p}��@��_�X�x��!��|p}8�@��_�2|�����`@��_���������X�p}����x��|p}���_�a�������H�����`�������@��H���X�0��8����c.|��������x�h]5|��������������6|h]:|������������ ��A|�p7|��������2H���h]E|��������������F|pE|���������������XeE|0�`������������ؕ^h�(�p���������Xei�ȕh]���������������������|p}�@��_�����X�!���|p}��@��_�H|�����`@��_���������-`�p�`@�����H����|p}h�`�������@��H���X�0��8���0�8�p��|p}����_���������@����_�����h]P|������������x��T|h]W|��������������[|xi[|����������`�l[|��������������Кh����h]g|��������������h|�l\|�����������������X�^U|��������`�������XeP|�h]u|������������x��y|xi~|��������������/ -�pz|��������-����h]�|������������x���|xi�|����������\ -�p�|��������-@�x�`o�|�����������`����������Щ�p}����_�Р�����X������|p}��@��_�p�����0��|p}P�@��_��|�}����`@��_���������@��H���h]�������������������Bad argu]�آ h]0}���������������<}�n/}��������5�`���������������������`�Xe����hg������������hgC��ȥ���|p}��@��_���Ȧ��h��|p}��@��_�>}w}�����`@��_������������x�������@�p�h� -�������������ؤXe -�H�h]W���������������H���P���������8��xi`���������P��A��p\����������� �`����������h]J}��������������S}h]V}��������������W}xiZ}���������� -`oX}��������&����^T}��������H������XeJ}@�fg}���h��������hg+}H�x��������e�}���h����hgq|�@������h]�}������������P��}xi�}���������� -xi�}�����������( -�p�}��������-X�ت`������������H�X������|p}Э@��_�����ЮP��|p}p�@��_��}E~��������`@��_������������������������h]�����������������l��������0�^u���������x������Xep�h�0��8�L�h���Ю����h]���������������E���xi�����������0�l��������������H�����������������x�h]~���������������~xi"~������������Pj�^ ~��������0�h���������Xe~��h]1~������������P�4~h]7~���������������8~xi;~������������0 -`o9~��������&8�p�^5~���������������Xe1~���h����hg�}���� �`�`�����h]P~������������x��T~xiY~���������.8 -�pU~��������-��ز`����������|(����_�ص�����X������|p}е@��_�����жP��|p}p�@��_�b~*����`@��_���������h�0�8�p���h]����������������xi������l����x���h]�~��������������~xi�~��������������@ -xi�~������������H -�p�~����������-0���h]�~��������������~h]�~���������������~� ^�~��������8�p������Xe�~��h]�~�������������xi��������x�P -�p��������-�H��n���������5��h]�������������xi ���������h�X -^���������8�����Xe���h����hg�~кл������hg�~����������`�������@��H���X�0��8���0�8�p���`�h��3�@@��O��Y�Xi�xs�H��������������P��h]4�������������<xiB��������Ƚ` -xiA�����������h -�p=��������-`����n=��������5(�`����������+��@��� 0F�P�R�S�����hb`eXh�k�yX������|p}�@��_���������|p}��@��_�E�����`@��_���������h�h]���������������xi�����������p -xi����������������x -^���������h�������Xe��0��h����hg0� h���������hgL~ �`�������H�����`�������@��H���X�0��8���0�8�p���`�h�8��|p}x�إ������ج�x����`��x��8��ر�H��h����� ����������������8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�����0�h��@������,�x-�x.�8/��4�4�6�=�>(D`DXFG�LxR8S�S�VW�W�]�^`_�a�oxpHvw�w@y�zH{|@}�0���@���0���(�P���8���H�H�����`�������@��H���X�0��8���0�8�p���`�h��������������H�����`�����X�H�������H�8�p����������������������P@xp0 X�H8p� -p 0 h � ��h]K�������������8�O�`����������X�0������|p}����_���������|p}�����_�Q�x�h]�������������������xi������������ -xi���������8���� -�p���������-���h]!�������������P�$�xi*������������ -xi)���������@���� -�p%���������-���`o���������P�X�h]x����������������xi����������@�� -�p����������-���`o,�����������X�h]ـ�������������������xi����������@�� -�p����������-���h]�����������������h]�������������P��xi -�����������8�� -`o���������'����p���������-��P�`o����������X���h]�������������� �h]%���������������.�xi1������������ -`o/���������&H����p!�����������-���`o ������������`o������������H�`���������^����������Xe��h]��� ��������x������|p}8�@��_����8� ���|p}��@��_�5� -������`@��_������������X����|��*�����@����_�������������`�����X�H�������H�8�p�� -�H�:-��� �v�= `� �����h]A�������������P�D�xiJ����������� -xiI���������H���� -�pE���������-����nE���������5`�`������������������������HC ��� -����������� ����|p}@�@��_�� �@� ���|p}��@��_�M�������`@��_���������h]�����������E������������z����������� �����h]������������������`�����X�H�������H�8�p����������H��l��������������������������hg��(�����h]����h][���������������d�xii��������������� -�pe���������-����h]n�������������p��x�`ok��������� �`�h]��������������0����xi����������@�pI�l�����������������h]��������������0����xi�����������hJ�l�������������������h]����������������������xi������������ ��l��������������X���(�H���h�h]�������������� ����h]��������������P����l���������������������e^�����������������^����������X������� Xe��`�h]ˁ������������0��΁xi΁��������0�� pI�l΁���������������h]ց������������0��فxiف����������� hJ�lف����������������h]������������������� xi������������ ��l��������������H����8�p�����h]�������������������h]��������������P����l����������������������^߁���������������^ԁ��������H������XeˁP�hgW� �����������h����hg=�����������`��������p�����XP |�@�HC ������������HC ����x��x����|p}��@��_�X�x�P!��|p}8�@��_��F����������`@��_�����������ҏ�u���h��Ȁ�� U(��݀��������H ����3����}6� �P��A�������*� � �����������������������P@xp0�3������������ ������������������������pNh]���������������%�xi*�����������`�� -�p&���������-��0�h]/�������������p��9�`o,���������x���`��������x�������A�������*� � pN����b -�������|p}��@��_�`����� ��|p}@�@��_�;�������`@��_���'���������������������%�����������ເн�.this_function]�P��s�`������������������܀������@��x��p������P��������輁h��Pցh]E�������������0��H�xiH���������h�hJ�lH��������������8�h]P���������������T�xiT���������(� ��lT�����������������������@�h][������������� ��b�h]d��������������l��lU������������������@���K�^N����������� �����XeE�x�h]w�������������0��z�xiz���������H�pI�lz����������������h]������������������xi����������� ��l������������������p������רh]�������������� ����h]��������������P����l������������������� �`���^����������`������Xew�X�`���������X8�.�(/�p/� 1�h1��1�(7�������|p}0�@��_����0����|p}��@��_����֩����`@��_�©��������h�����0��x��h�����`��������H�H�����P���P@xp0 XX1�X2��3��4��7��\��M� N�P�XP�hj��j�0l�xl�h]��������������0����xi������������hJ�l������������������h]����������������‚xi‚��������� ��l‚������������P� @x��h]ɂ��������������҂h]Ԃ�������������܂�lÂ��������������������^���������������Xe��h]��������������0����xi�����������pI�l��������������p�h]������������������xi����������� ��l��������������0h XPI�h]�����������������h]�������������P� ��l���������������������%�^����������������Xe������������������������P@xp0 X�H8p����H��������ؤ�hg���0�������h]�������������0���xi�����������K�l���������������h]&���������������*�xi*����������� ��l*�������������H�8p(;�h]1��������������9�h];�������������P�>��l+������������������^$��������������Xe� hg�����(����� ������������x����`���yH~x~Ѐ��ЈȊ؍��h P�p����X�������� ����h]P���������������Y�xi\��������� � -�pZ����������0� -� -h]e�������������0��h�xih���������� �G�lh�������������p � h]o���������������s�xis����������  ��ls�������������0 h   � @c�xiz����������P � -h]}�����������������xi������������ � -`o����������'h � �lt������������������ � ^m���������� (����Xee��h]��������������p����h]��������������0����xi������������G�l�������������� Xh]������������������xi����������H ��l������������������-xi����������� -h]ă������������ ��˃�l������������������`�v^�����������P����Xe����h����hg��������hgL�0 � ����h]ڃ������������0��݃`fӃ�HC x���� ����h]���������������������ha����x��h]����������������������v�o��������^�������������p�����Xe������t�o�����"��x��X����@��_�����o�"0��8����xi�������0�E�xi�������x��H��������delimiterG]�� ���Cxi�������(�;�]�@�g;�xi�������H�x��������xi�������]�xi���������0��������posix]����DA"xi��������xi����������������� j�K����^�����h]"�H��������#�ha����HC ���]� #�^����D������`����Xe����P`'�� H�h]-��������������2�H��j(����xi[�������H^���@H^��|p}�+@��_� @RC'�6 �@i�|p}@��_�t��������`@��_�����������c���i��#��v@Y�Ƹ‰H -��k�P� -�P:-�����P%�s��� ��v�= `>��!N�������`���8!�!0#�#�$x+(6�)�-�.�/807�78@8p!h#0%�+�\�\`^�^e�H(HC �� ���������HC �H -�����HC �� -������������� H� -�� 0� �� �h�( jh x"p$8.�T�h`�`}������ `"h]��������������`>���xi���������� !��h]���������������!��ha}�8!�HC �`>���h]�����������������!����^��������������!� ����Xe����"`�������"�X$h]���������������i���xi����������Pj�h]���������������#��ha��0#�HC ��i���h]�����������������#����^��������������##����Xe����$`�������$h]�������������������h]��������������P%��ha���$�HC �������('���|p}H'@��_�(((�N!�(�|p}�(@��_�̄������`@��_����������1�f8g�0@1x2�P�Ѕ�py�y�{`����)�-�.�/807�78@8�=(>�>�>�@A�A(�p��������� ��< =h]ф������������@Y�҄h]Մ������������ބxiބ��������H*X[�lބ�������������)*xi�����������* `o����������'`*�*`̈́����p+� .h]��������������P-��hä́x+�%��0����P%�s�0���л�i��#��v@Y�P-Ƹ‰� ��v�= ��6&�(5H -��k�P� -�P:-������`>��!N���@�HC �@Y���h]����������������P-����^��������������-�*����Xe�����-�cȄ�����0(+�/�0h]��������������P-��xi�����������. xi����������8/�� �p����������2�./h]���������������#��n����������5�/`o����������P/�/h] �������������P- -�p -����������80����Xe -�p0`��������1�5�A�B IK�N`�xc��h��k��n��% 3���|p}@3@��_�4 4`K!�4�|p}�4@��_����������`@��_�I����������D1 ��23x����56P��(�89X Xf;<�>�?Xq@��A( B7�78@8�=(>�>�>�@A�A8B�BPI�IHJ�P� ��(� ��`������5h]������������� ��h]��������������6�ha�(6�1HC � ��@ip!h#0%�+`6h]*�������������P-+�xi/���������x7 �p,���������27H7h]:��������������6>�h]A�������������J�h]K�������������P-L�lJ�������������8@8^?����������7x8����Xe:��8`��������h9�@�A�k��n��x��{���� ���1p;���|p}�;@��_�P<p<�<=�|p}0=@��_�Z���|�����`@��_��������������6P��78�\X :;h��=>�Xq@A( xwCp����=(>�>�>�@A�������P��� ��(� ��h]h�������������P%k�h]p���������������y��pl���������-�=(>h]��������������P%��h]��������������0���xi����������@?���l���������������>?�?�l������������������X?�?^�����������>�?����Xe�� @�h����hgd�`>p@�@����h]���������������6��h]��������������P%��^�����������@A����Xe��8Ahg&��79 9����h]���������������F�DžB8Bh]ȅ�������������6̅�l�������������������ABXe��pBh]���������������6��xi����������HCX[�l���������������BCxi����������C �p���������-`C�C`��������pD�H�1xF���|p}�F@��_�XGxG�GH�|p}8H@��_� �$�����`@��_����������e�8.�h����hg���C(DI����h],��������������!8�h];��������������6?�xiB����������I`&�`o@���������&�I�Ih]H��������������!T�`oF���������&JHJ^9���������PI�J����Xe,��Jh]\��������������#l�7�78@8�=(>�>�>�@A�A8B�BPI�IHJ(KhLh]o��������������6s�xis����������L�`�ls�������������hL�L8MXMxi����������M( �lt������������������L(Mxi����������(N/0 �p����������-�M�M^m���������(K@N����Xe\��N�)�-�.�/807�78@8�=(>�>�>�@A�A8B�BPI�IHJ(KhL8!�!0#�#�$x+(6�)�-�.�/807�78@8�=(>�>�>�@A�A8B�BPI�IHJ(KhL�P0Q�Qh]S��������������!_�h]b��������������?�v�xQ�Q Th]w��������������!��h]���������������#��8!�!0#�#�$x+(6�)�-�.�/807�78@8�=(>�>�>�@A�A8B�BPI�IHJ(KhL�P0Q�Q�QUZ�[�\�b�n����������5�Q�lb�����������������0QhQ^`����������PPT����XeS��Th]���������������#��`���������U�\��W���|p}�W@��_�xX�X�X8Y�|p}XY@��_��� �����`@��_���������Z�[h]���������������!̇xi̇���������ZX[�l̇������������ZPZxiև��������[8 �pԇ��������0�Z�Zxi�����������[`&�h]���������������!��`o����������&`[�[`f���[xi���������h\`&�`f�8\hg�� [ \�\����h]*��������������!6�xi6���������0]X[�l6��������������\]xi@����������]@ �p>���������0H]�]`��������X^c�``���|p}�`@��_�@a`a�ab�|p} b@��_�C�e�����`@��_����������bh]R��������������!^�`fK��b`��������xcHh��e���|p}�e@��_�`f�f�f g�|p}@g@��_�k�������`@��_���������xiz���������0h(2�`fs�hhg&��]^0c����hg��UHU`h����HC �H^�����h]�����������������h����ha����i�h]�����������������h�����vd���������^�������������`i�i����Xe�����i�td������"H^�� ��@��_��j�j�jd�p(j����xi������� kx5����lx5��|p}�l@��_��m�m�!`n@o���|p}�n@��_���������`@��_������������Xw�n�H -��o�k�P� -��o:-�����|���~� �@ov�= ��p&�(5�p�phq�qxr�tw�x�y�{�|�|P}�}�~�����8w�{HC 8k� ���������HC 8kH -���������HC 8k� -��������� ��p��h]���������������p��HC 8k �����H� -`r0t`tx�~��ȅh]���������������F�ˆ�q�qh]È�������������pLj�l������������������hq�qXe��rh]ӈ�������������p׈xi׈���������rX[�l׈������������xr�rxi����������hsH �p߈��������-�r8sxi�����������s(2�`f���s�h����hgψ�st t����`�������t�wh]���������������� �h]��������������p�xi���������Pu�`�l��������������t u�u�uxi ���������vP �l�����������������hu�uxi'����������v/X �p#���������- vxvh]'�������������Xw)�ha��w8kHC 8k���)�^�������������w�v����Xe�����w`4�����Px�|h]:����������������K�h]N��������������pR�xiR����������x�`�lR��������������x�x`y�zh]^��������������pb�xib����������yX[�lb��������������y�yxil���������pz` `oj���������'z@z�lS�����������������yPyxis���������P{/h �po���������-�z {h]s�������������|u�ha4��{8kHC 8k���u�^��������������{h{����Xe����H|h]���������������p��h]���������������?���0}P}�}h]���������������p��h]��������������Xwȉ�n����������5�}�l�������������������| }^�����������|�}����Xe��H~h]ԉ�������������p؉xi؉��������X[�l؉�������������~�~xi�����������p �p����������-0ph]��������������Xw���n����������5�`o�����������0�h]���������������p�xi����������(2�^�����������؀����Xe�� ��h����hgЉ`�p�������h]��������������p��phq�qxr�tw�x�y�{�|�|P}�}�~���ȁ�����x�Їxi���������8�X[�l�������������ȁ�xi�����������x �p���������0P���h]#�������������|4�`o ���������؃�h]<��������������p@�xiD�����������`&�^A������������Ȅ`�����`oB���������&��ȄXe<���h����hg �P���������h]R�������������Xw\�xik���������`�`&�h]q��������������pu�`oo���������&0�x�`fd����h����hgN����������p�`r0t`tx�~��ȅ��h]���������������p��`f{�ЇHC 8kx5�����h]���������������� �����ha����h�8kh]���������������� ������v����������^���������������������Xe���� ��t�������"x5�8kq��@��_���(����j������xi�������������� �����|p}@�@��_�� �@�������|p}��@��_��������`@��_���������H -����k�P� -�0�:-��� ���v�= �0�&�(50���Ȑ0�ؑ ��HC ��� ���������HC ��H -���������HC ��� -��������� �����h]��������������0���HC �� �����������x�h]���������������F�NJ�0�h]Ȋ������������0�̊�l������������������Ȑ�Xe��h�h]ڊ������������0�ފxiފ��������@�X[�lފ������������ؑ�xi����������Ȓ� �p����������0X���h]��������������0���xi�������������`�l�������������� �X����xi����������@�� �l����������������������xi�����������/� �p���������-X���`o��������������`fӊ8�HC ���������h]����������������������ha����ؕ��h]�����������������������v����������^�������������0�h�����Xe�������t�������"�����x���@��_���������P�������xi��������pv�����pv��|p}��@��_�p����!0����X��|p}P�@��_�)�������`@��_���������Р@Y��Ƹ‰H -�X��k�P� -���:-��p��h��̙� ��v�= �~���v]�i��(����H�8�p�p�`�����P���`�x�����`���H�HC �� ���������HC �H -�����HC �� -���������x�P�p�����8���h]6�������������X�?�xi?��������� �X[�l?�����������������xiK������������ �pG���������-8�x�xi[���������0�(2�`fT���h����hg2���H�`�����`d�������h]h��������������~�n�h]h���������������n�had�(��HC ��~�h��X����|p}x�@��_�8�X�x����|p}�@��_�x�e�����`@��_���������ЩH�8�p�p�`�����P���`�x���(�`����h]}�������������@Y�~�xi����������@�� `y�������Цh]�����������������hay���РHC �@Y���h]���������������������^�������������H������Xe�������ct������X�0���h]�����������������h]��������������X���xi����������اX[�l��������������p����p����������/8���h]�����������������p�����������p�����Xe����`��������P�حH���РX����|p}x�@��_�8�X�x� ���|p}�@��_���e�����`@��_���������p�`�����P���`�x���(�`����`������ �8�h]��������������p����h]��������������X���h]�����������������l��������������`���h]��������������h���ha���ЩHC �p����h]����������������h�����^���������������Ю����Xe������h]ŋ�������������F�ϋ����h]Ћ������������h�Ӌ�lŋ����������������P���Xeŋ��h]��������������h���xi����������ȱX[�l��������������`���xi����������P�� �p����������0�� �`������������Щ�����|p}�@��_�ص������|p}��@��_���_�����`@��_���������x���(�`����h]�����������������h] �����������������p���������-x���h]���������������$�h]'�������������h�*�^%���������(�`�����Xe���h]C���������������I�xiM���������h�`&�h]S�������������h�V�`oQ���������&8���^J�������������H�����`oK���������&���XeC���hg�������������h����hg܋h���к������(����H�8�p�p�`�����P���`�x���(�`�����P�h�X�h]n���������������t�h]y������������������pu���������-�P�xi������������(2�`f��ȼ�h����hgj����(�����h]������������������xi����������нx5�l��������������h���8�X�h]�������������������l��������������������(�`f����HC �pv�����h]���������������������ha����H��h]����������������������v���������^���������������ؿ����Xe������t������"pv��h���@��_���������h� ����xiÌ�����`�h)����h)��|p}� @��_�����[�z�N ��(��|p}��@��_�ތr� ����`@��_����������~�/���潳�PE���~���H -���k�P� -�H�:-��(U�fA��� ���v�= H/���v ������H�`���p��������������(���H�p������hG�ŀX@��^��5�@H��v��)��.�{�(j�)����x���8k���x�h�`����z�(�HC x�� ���������HC x�H -���������HC x�� -���������H/�����/�H���h]ߌ����������������h]������������������HC x�H/�����HC x��/������ #X�h�������0�`�h]���������������F�������h]�������������������l������������������`���Xe���h]��������������F������h]�����������������l�����������������p���Xe��h]���������������"�h]'���������������)��p#���������-����xi8���������`���`f1�0��h����hg���x�������h]A���������������E�h]H���������������M�xiM���������p�H^�lM��������������@�����h]V���������������Z��lN���������������������^F�����������0�����XeA���h]a���������������c�h]f���������������k�xik�����������H^�lk�������������(�`����h]t���������������v��ll���������������������^d�����������P�����Xea���h]������������������h]�������������������p����������-�H�xi��������������`f�����h����hg~���� �����`ɍ������`�h]͍������������PE�֍�H�`���p��������������(���H�8�������x�h������ �X���p�������xiٍ�������� �� h]ٍ��������������ڍhaɍ8�x�HC x�PE�ڍh]����������������������^���������������������Xe�����x�����|p}(�@��_����(����|p}��@��_���U�����`@��_���������p�����x�h��c������������h]������������������h]������������������xi����������x�X[�l���������������H��p����������/����h]��������������� �p���������������Xe�H�`�������������������|p}�@��_���������|p}��@��_� �U�����`@��_���������x�h�h]����������������xi������������`�l�������������x���H�h�h])���������������2��l�������������������8�xi8���������(�/� �p4���������-�����n4���������5@�fI����h����hg�����������X�h�������0�`��������0�����8`Z���������h]^�������������(U�e�h]h���������������l�xil�����������X[�ll��������������P�h]m���������������s�haZ���x��z�h���� X[�P���7 ����ˈ: �/���潳�(U���fA��� ���v�= H/���v �H -���k�P� -�H�:-��k�8�J��،�(�(�A -PE���~���h�(�N��HC x�(U�s�h]����������������������^���������������������Xe����0�`y���������h]}�������������h���h]������������������h]������������������`o����������' �X�h]��������������(���hay���x�HC x�h���h]����������������(�����^�������������p�������Xe������`ǎ����X��h]ˎ������������k�ҎxiՎ����������� h]Վ������������8�֎haǎ��x�HC x�k�֎h]����������������8�����^���������������������Xe������x������|p}��@��_�������P��|p}p�@��_���G�����`@��_���������������� ���c܎����P�x�8�h]��������������8���h]������������������xi���������� �X[�l�������������������p����������/��8�h]��������������8��p�����������������Xe����`������������(������|p}��@��_�������@��|p}`�@��_��G�����`@��_��������� ��h]����������������xi������������`�l������������� �X����h]�������������8�$��l���������������������xi*�����������/� �p&���������-H����n&���������5��f;�0��h����hg �(�X�p������H�`���p��������������(���H�8�������x�h������ �X���p����������� ��P���� �X���p��H���P�` - NhRP�0h��0" #X#�)`L��������h]P��������������z�U�h]X���������������Z�xiZ�����������X[�lZ�������������P���h][�������������h�a�haL��x�HC x��z�a�p����H�0�� -h]����������������h�����^���������������������Xe����0�`g��������h]k�������������،�p�h]t�������������h�y�h]|�������������8���`oz���������' �X�h]��������������(��hag���x�HC x�،���h]����������������(����^�������������p������Xe�����`ʏ����X h]Ώ������������X[�ԏh]؏������������(�ߏh]��������������(���p����������/��h]��������������(���h]��������������(��r؏��������H�h]��������������P��haʏ�x�HC x�X[���h]����������������P����^�������������������Xe�����`������x h]�����������������xi����������� xi���������8��� h]���������������ha�Px����R�~���hN��<X[�P���7 �/���潳�(U���fA��@Y�� -Ƹ‰ k�8�J��h�(�N�������ˈ: H��@a�GpB� ���v�= H/���v �،�(�(�A -H -���k�P� -�H�:-���z�h���� PE���~���HC x�����h]���������������������^������������������Xe����( `������ � h] �������������@Y�!�xi$���������H -� h]$�������������� -%�ha�` -x�HC x�@Y�%�h]����������������� -����^�������������  -����Xe����8 ��X�h�������0�`��������0�����8� �`hx�x�H���|p}h@��_�(H�YC'��|p}@��_�/�ʔ����`@��_���������(P�0h��0" #X#�)p*�*,�1�2�c+�����`�Hh]2�������������� -3�h]7�������������P=��p4���������1Ph]A�������������� -B�pA���������������XeA�`���������`K�K�O�X� ����|p}�@��_����TC$P�|p}p@��_�D�ʔ����`@��_����������0h��0" #X#�)p*�*,�1�2�2(4`4h]P�������������� -Q�h]V�������������P\��pR���������-0h`��������(J0J(0���|p}P@��_�0�H!��|p}�@��_�^�������`@��_����������5��0" #X#�)p*�*,�1�2�2(4`4�9�:h]l�������������(q�h]t�������������Pz��pr���������0��`����������3�����|p}�@��_�� � �  -P!�|p}p!@��_�|�)�����`@��_����������-0" #X#�)p*�*,�1�2�2h]������������������xi�����������"�`�l��������������0"h"#�#h]��������������8���h]��������������� -��`o����������& #X#�l�������������������"�"xi����������X$/� �p����������-�#($`���������$,('���|p} '@��_��'( (�(�|p}�(@��_���t�����`@��_����������)p*�*h]N���������������P�xiP����������) ��lP��������������)�)P*h+h]W�������������8�^�h]a�������������� -b�`o_���������&p*�*xie���������P+� `oc���������&�* +�lQ�����������������*@*`fG��+h]~�������������� -�xi�����������,� �p����������-,P,`�������� -�3((/���|p}H/@��_�0(0H0�0�|p}�0@��_��������`@��_����������1�2�2h]������������������xi����������2 ��l���������������1�1x23h]�������������8� �h]�������������� -�`o���������&�2�2�l�����������������(2h2`f��H3�h����hgz��,�,�3����hg��p$�$�3����h]3�������������(�:�h]=�������������PC��p;���������0(4`4`�������� 5�H�(7���|p}H7@��_�8(8H8�8�|p}�8@��_�E�ۓ����`@��_���������XC�9�:�:�@0A�A`Gh]U���������������Y�xiY���������:�`�lY��������������9�9x:;h]e���������������n�h]q�������������� -r�`oo���������&�:�:�lZ�����������������(:h:xix����������;/ �pt���������-H;�;`��������p<�A�5x>���|p}�>@��_�X?x?�?@�|p}8@@��_���2�����`@��_����������@0Ah]��������������!�h]$�������������� -%�^"����������@0A����Xe�hAh]<�������������� -=�xiB���������8B �p>���������-�AB`���������B0H�5�D���|p}E@��_��E�EF�F�|p}�F@��_�E�ѓ����`@��_���������`Gh]�����������������xiÓ���������G ^����������`G�G����Xe���G�h����hg8�PB�BHH����hgQ��;(<XH������0" #X#�)p*�*,�1�2�2(4`4�9�:�:�@0A�A`G�h����hg/��4�4�I����hgh� `�I����f���0h��0" #X#�)p*�*,�1�2�2(4`4�9�:�:�@0A�A`GLM@MHOpP`Q�QS�S�S�h����hgL���PK����`�������K�Oh]�����������������h]��������������� �xi ����������L�`�l �������������LPL�LxMh]���������������!�h]$�������������� -%�`o"���������&M@M�l ������������������L�Lh]%�������������hN&�ha��N(HC x��� &�(�p����H�0�� -HN�R ah]����������������hN����^�������������HO�M����Xe�����O`.�����0P�Sh]2���������������8�h];���������������=�xi=����������P�`�l=�������������pP�P@Q�Qh]I�������������8�P�h]S�������������� -T�`oQ���������&`Q�Q�l>������������������P0Qh]T��������������RU�ha.�hR(HC x��� -U�h]�����������������R����^�������������SR����Xe����@Sh]a�������������hNi�h]n��������������Rt��pj���������-�S�S�nj���������5Tf~��h]��������������hN��0h��0" #X#�)p*�*,�1�2�2(4`4�9�:�:�@0A�A`GLM@MHOpP`Q�QS�S�S�TxW�Wxi���������� W/ �p����������-�T�Vh]�����������������h]”������������� -Ô^����������xW�W����Xe���W�h����hg��8W8XPX����hg]�XT�T`X����P�0h��0" #X#�)p*�*,�1�2�2(4`4�9�:�:�@0A�A`GLM@MHOpP`Q�QP�0h��0" #X#�)p*�*,�1�2�2(4`4�9�:�:�@0A�A`GLM@MHOpP`Q�QS�S�S�TxW�W�H�`���p��������������(���H�8�������x�h������ �X���p����������� ��P���� �X���p��H���P�` - NhRP�0h��0" #X#�)p*�*,�1�2�2(4`4�9�:�:�@0A�A`GLM@MHOpP`Q�QS�S�S�TxW�W�`�a8fpf�f`h�hixn�n(op@v�w�xHz�{�{�|�|�� �������Ї`Д����``bh]Ԕ������������H��הxiڔ���������`��h]ڔ������������@aܔhaД�`x�HC x�H�� ܔh]����������������@a����^��������������a�`����Xe�����ax��c���|p}�c@��_��d�d�d Xe�|p}xe@��_�D�!�����`@��_���������pj8fpf�f`h�hixn�n(op@v�w�xh]E�������������� -F�h]I���������������R�h]U��������������b�`oS���������&pf�fxie���������Pg `oc���������&�f g^G���������8fhg����XeE��g�c@������i�g�h�ih]h�������������� -i�h]m���������������t��pj���������1`h�hh]x�������������� -y�px����������i����Xex�Hi`���������iz0b�k���|p}l@��_��l�lm�m�|p}�m@��_�{�!�����`@��_���������8rxn�n(op@v�w�xh]��������������� -��h]�������������������p����������-xn�nh]������������������xi�����������o�`�l��������������(o`o�oph]��������������� -���l�������������������o�oxi�����������p/( �p����������-Pp�p`o�����������n�p`���������q�ypj�s���|p}�s@��_��t�t�t`u�|p}�u@��_��������`@��_���������@v�w�xh]ƕ������������@aɕxiɕ���������vX[�lɕ������������@vxvxiՕ��������0w0 �pѕ��������-�vwh]��������������@a��xi�����������w��^������������w�wXx����`o����������&�w�wXe��xh]�������������@a �xi ���������y �^ -�����������x�x�y����`o ���������&�x�xXe�0yhg•Hw�x�y�����h����hg��0qpqz����h]��������������@a��xi�����������zX[�l��������������Hz�zxi����������8{8 �p����������0�z{h]��������������@a��h]������������������xi����������0| ��l���������������{|�|(}h]Ö������������8�ʖh]͖�������������ږ`o˖��������&�|�|�l������������������H|�|`o����������&�{h}`f���}`��������`~����`�x�h����|p}��@��_�H�h�����|p}(�@��_���n�����`@��_����������� �������Їh]��������������8���h]����������������^������������� �������`o����������&�� �Xe��X�h]����������������xi���������h��`�l��������������8�Є��h] �������������8�'��l���������������������xi-�����������/@ �p)���������-(���h]@�������������8�G�p@���������������Xe>�@��h����hg�ȅ��������h]V���������������X�xiX���������H� ��lX������������������Їh]_�������������8�f��lY�����������������`���`fO��hg��P{~~����HC x�h)� ����h]����������������������ha������x�h]�����������������������v͌��������^�������������H�������Xe�������t͌�����"h)�x����@��_�������͌0��"�����j(��������(� z��xix������P�X.�����X.��|p}�@��_�Ѝ�����p�h��|p}��@��_���������`@��_���������H -����k�P� -��:-��� �p�v�= ��&�(5�Ȑ��h�HC h�� ���������HC h�H -���������HC h�� -��������� �Ȑ��h]�����������������HC h� �����X�8�Бh]�����������������`f����HC h�X.�����h]����������������������ha����0�h�h]�����������������������v����������^���������������������Xe�������t������"X.�h�H���@��_��������� �P�$����xi������H��z������z��|p}� @��_�Ȗ��8�!!�� h����|p}��@��_�їD�����`@��_���������x����z��dH -����k�P� -���:-�� T���*��8�����I� �h�v�= ���&�(5�������������@���`����ئ0�ШP���؟����h�HC `�� ���������HC `�H -���������HC `�� -��������� ���֗h]җ��������������֗HC `� ������� ��X�������x�ذh]ޗ�������������F���ؚ��h]�������������������lޗ������������������ȚXeޗ0�h]������������������xi�����������X[�l����������������؛xi�����������H �p���������- �`�xi����������(2�`f����h����hg����0�H�����`!�����НȠh]%������������� T�)�h],���������������0�xi0���������x��`�l0��������������H����xi<���������0�P �l1�������������������Оh]=���������������>�ha!���`�HC `� T�>�h]����������������������^�������������@�H�����Xe����x�`D�����(���hasRoot]�0���Ih]H�������������8�O�h]S���������������W�xi\����������/X �pX���������-��ءh]c���������������d�haD�`�`�HC `�8�d�h]����������������������^�������������� �����Xe����8�`j�������`�h]n����������������q�xiu���������X�` xit�������������h h]u���������������v�haj���`�8�����I� �h�v�= ���&�(5@Y���Ƹ‰�����z��dH -����k�P� -���:-�� T���*��Ќ������nHC `����v�h]����������������������^�������������ئp�����Xe�����`|�������X�h]��������������Ќ���xi�����������łh]������������������ha|�0�`�HC `�Ќ���h]����������������������^�������������Ш�����Xe�����`�����|p} �@��_���� � ���|p}��@��_���������`@��_���������H���8�(���P���x�p��8�p�8�h]��������������@Y���h]������������������xi���������� �X[�l������������������xi������������p `o����������'8�x�`������H���h]������������������ha��P�x�HC `�@Y�����؟����h���h]����������������������^�������������8�������Xe����p��c�����������h�h]������������������xi������������x �p����������2(�`�h]����������������˜p�����������������Xe�� �`��������ȲX��x�д���|p}��@��_���е��p��|p}��@��_�Ę������`@��_���������0�P���x�p��8�p�8�h]̘��������������Иh]Ә��������������טxiט�����������`�lט����������������X�x�h]�������������������lؘ�����������������H�^ј��������P�������Xe̘�h]������������������xi����������ع/� �p����������-p���`��������x�8�H������|p}��@��_�`����� ��|p}@�@��_��W�����`@��_���������0��8�p�h]�����������������n���������5�`��������������������|p}��@��_�������X��|p}x�@��_� �O�����`@��_���������8�p�h],���������������/�h]2���������������3�^0���������8�p�����Xe,���f?�ذ�h����hg �8�h�(�����`������������H������|p}��@��_�������X��|p}x�@��_�]�������`@��_���������8�h]������������������xi����������Pj�^����������8�p�����Xe����hg����0�h����������������@���`����ئ0�ШP���8�(���P���x�p��8�p�8�@�H�0�h�@�x�h]Ù��������������ƙxi̙����������� xi˙������������� �pǙ��������-@���h]ܙ����������������xi������������`&�xi������������(2�rܙ��������H�����`fՙ��h����hg���P�h�����p���X�������x�ذx���h]�����������������h]����������������xi ������������ �p���������-h���`o���������0���//] �h���sxi�����������p�`f����h����hg��(��������h]-���������������1�xi1����������� ��l1�������������@�x��0�x�xi8���������`�� h];���������������>��l2��������������������`f&���HC `��z�����h]���������������� �����ha����h�`�h]���������������� ������v����������^���������������������Xe���� ��t������"�z�`�@���@��_���(������&����xiJ� �������i��� ��i��|p}�� @��_�� ��IC<0� ���x�|p}��@��_�e�ԣ����`@��_�����������LK���v:�H -����k�P� -�0�:-��H}�P��S_���z��d� ���v�= �h�&�(5h�����0�H���(����������P�p���h���0�0������HC ��� ���������HC ��H -���������HC ��� -��������� ���j�K�0�o�h]f�������������h�j�h]l���������������o�HC �� �����HC ��K������hy���(�8����wh]{���������������~�h]�������������������p���������-H����n���������5��h]�������������������n����������8(�xi������������`��p����������-`����n����������5��`o�������������h]��������������x�š����xiÚ�������� ��s�hm�������������������s����������8�Xe�����h����hgw�H���������h]���������������F���`���h]��������������h����l�������������������P�Xe����`�����p� �h]�������������H}� �xi������������ h]�������������P��ha�����HC ��H}��h]����������������P�����^���������������������Xe������`���������h]�����������������xi ������������ xi���������8���� h] �������������(�!�ha�P���P����*&{� -K���v:�� ���v�= �h�&�(5@Y���Ƹ‰H -����k�P� -�0�:-��H}�P��S_���(�z��dЌ� ����n�����F��� HC �����!�h]����������������(�����^�������������p������Xe������`'�����X���h]+�������������Ќ�7�xi:����������łh]:������������� �>�ha'�����HC ��Ќ�>�h]���������������� �����^�������������h�������Xe������`D�����P�h]H�������������@Y�I�h]H���������������I�haD�����HC ��@Y�H�h]T���������������W�h]\���������������e���0�H���(����������P�p���h���0�h����`���0�p�0�0�h�H�x������x�pX���������-0�h��nX���������5��h]i���������������l�xil�����������X[�ll��������������P�xiv����������� �pt���������0����`of����������� �h]{���������������~�xi~����������X[�l~�����������������h]��������������h���xi������������X[�l��������������`����p����������1 ���`ox���������`� �`���������������h�G�I�������|p}�@��_�����`E!���|p}��@��_���`�����`@��_����������p�0�0�h�H�x������x�B�BHC�C Dh]������������������xi������������X[�l��������������p���h]��������������h���xi������������X[�l��������������0�h��p����������-����h]����������������Ûh]ț������������h�̛�pě��������-0�h�`o��������������xiݛ��������P���`f֛ ��h����hg����h�������`��������h]�������������������h]������������������xi������������X[�l��������������H���xi���������8�� `o����������'���h]����������������ha����h�HC �������x0��������h�h]����������������������^�������������x�P�����Xe������` -�����`�X�h]�������������P���xi"������������ xi!������������� h]"���������������#�ha -�0�h�HC ��P��#�h]����������������������^���������������������Xe�����h�����|p} �@��_��� ��|p}�@��_�/�Š����`@��_�������������xh]0���������������1�h]4�������������h�8�xi8��������� X[�l8���������������xiB����������� `o@���������'8x^2���������������Xe0��c+�����P8�h]E���������������F�xiJ��������� � �pG���������2��h]O���������������P�pO����������x����XeO��`��������X�� hB��`���|p}�@��_�@``A! �|p} @��_�R�Š����`@��_���������8 T�@ *��h -X � � ���@$�$ %�&,P,@-�2 `\�����( -� h]b������������� T�f�h]i�������������h�m�xim���������� -�`�lm�������������h -� -8 X h]y���������������z��ln������������������ -( h]z�������������@ {�ha\�� �HC � T�{�^�������������� � ����Xe����� h]��������������@ ��xi����������X /� �p����������-� ( `��������� @����|p} @��_�� ��|p}�@��_���������`@��_�������������h]6������������� �B��n5���������5�`��������0x8���|p}X@��_�8X��|p}�@��_�D������`@��_�����������h]R�������������P�W�h]Z���������������[�xi^���������X� `o\���������&�(^X����������p����XeR��fm�h�h����hg1���0����`���������X&0A�����|p}�@��_����`�|p}�@��_���������`@��_���������(@$�$ %�&,P,@-�2989�>@P@h]������������������xi����������� xi������������� �p����������-@�`����������$0&8�!���|p}�!@��_�x"�"�"8#�|p}X#@��_���������`@��_���������$�$ %h]V������������� �b�xie���������Pj�^c���������$P$����XeV��$h]x�����������������h]������������������xi�����������% `o����������& %X%^�����������$�%����Xex��%�h����hg��HH&����h]������������������xi�����������& �p����������2�&�&`���������'�@8�)���|p}�)@��_�x*�*�* 8+�|p}X+@��_���������`@��_����������:,P,@-�2989�>@P@h]��������������@ �h]��������������� -�xi -����������,�`�l -�������������P,�, -@-h]�����������������l ������������������,-�p���������-,x-`��������X.�9(`0���|p}�0@��_�@1`1�12�|p} 2@��_��������`@��_����������4�2989h]5���������������;�p5�����������2����xiA����������3 xi@����������3��( �p<���������-3�3`��������x4�9�.�6���|p}�6@��_�`7�7�7 8�|p}@8@��_�D�ܟ����`@��_���������989h]ğ������������(�ǟh]ʟ��������������˟^ȟ��������989����Xeğp9�h����hg/��304�9����`��������`:@�@(h<���|p}�<@��_�H=h=�=>�|p}(>@��_���������`@��_����������>@P@h]g���������������m�xiq���������P?0 xip����������?��8 ^n����������>h?����Xeg��?h]��������������(���h]������������������^����������@P@����Xe���@hg���-.:�����h����hg��'H' A����h -X � � ���@$�$ %�&,P,@-�2989�>@P@hg��p � p����h]Ѡ������������P�֠h]۠������������(�ޠ�pנ��������-�B�Bh]��������������(���h]������������������^����������HC�C����Xe���Ch]�������������(��xi����������D@ xi����������D��H �p���������- D�Dh]#�������������(�&�p�0�0�h�H�x������x�B�BHC�C D(EhFH�H(Ih])�������������h�-�xi-����������FX[�l-�������������hF�F^'���������(E�F����Xe#�(G�h����hg ��DxG�G����hg͠CD�G����h]C�������������h�G�xiG���������hH ��lG�������������H8H�H�H(Ih]N�������������P�S�h]U�������������(�X��lH������������������H�H`f<�`I��0�H���(����������P�p���h���0�h����`���0�p�0�0�h�H�x������x�B�BHC�C D(EhFH�H(I�TUW�W(]^d8ipi�j�p�q�qhsuv8v`��������0L�V�t�w��8N���|p}XN@��_�O8Opv!�O�|p}�O@��_�f�У����`@��_����������P�TUW�W(]^d8ipi�j�p�q�qhsuv�LHR���|p}hR@��_�(SHShS �S�|p}T@��_�r�{�����`@��_��������� Y�TUW�W(]^d8ipi�j�p�q�qh]s���������������t�h]w�������������h�{�xi{���������hUX[�l{�������������U8Uxi�����������UP `o����������'�U�U^u����������TV����Xes�HV�cn�����XX�V�W@Xh]������������������xi����������hWX �p����������2W8Wh]������������������p������������W����Xe���W`���������X8s�P�Z���|p}�Z@��_��[�[�[ H\�|p}h\@��_���{�����`@��_����������l(]^d8ipi�j�p�q�qh]��������������h���xi�����������]�`�l��������������(]`]�]^h]�������������������l�������������������]�]xi�����������^/` �p����������-P^�^`��������x_�j Y�a���|p}�a@��_�`b�b�b c�|p}@c@��_�á������`@��_���������0ed8ipih]^������������� �j��n]���������5d`���������d�j�j�_�f���|p}�f@��_��g�g�gXh�|p}xh@��_�l�������`@��_���������8ipih]z�������������P��h]������������������xi�����������ih `o����������&pi�i^����������8i�i����Xez�0jf���V�h����hgY�8dhd�j����h]��������������(���xiĢ��������Xkp xiâ���������k��x �p����������-�jpk`��������@l�q�r YHn���|p}hn@��_�(oHoho�o�|p}p@��_�Ǣs�����`@��_����������p�q�qh]=������������� �I�xiL���������Pj�^J����������pq����Xe=�0qh]]�������������(�`�h]c���������������d�xig���������8r� `oe���������&�qr^a����������qPr����Xe]��r�h����hg���k�k�r����hg���^0_s����h]��������������(���xi�����������s� xi����������t��� �p����������-hs�sxi�����������t��`f��pt�h����hg��0t�t�t����h]��������������h���xi����������xu ��l��������������uHu�uv8vh]��������������P�ãh]ţ������������(�ȣ�TUW�W(]^d8ipi�j�p�q�qhsuv8v�l�������������������u�u`f��xwhgP�`����K����HC ���i�����h]����������������x����ha����`x��h]����������������x�����vT���������^��������������x�x����Xe����y�tT� ����"�i�������@��_�zz zT�P��y(����xiڣ����xz�(���|�(��|p}�� -@��_��|}��!x� �~ ��|p}�}@��_���N�����`@��_��������������0�@�V�W!H -��~�k�P� -�(:-��83�P�bF:,���z��d� ��~v�= �(�&�(5(����(���������P�p�Ȋh�،��@����� �0����HC �z� ���������HC �zH -���������HC �z� -��������� ����h]��������������(���HC �z �����H� -��Ё(�8�����h]��������������F� -��(�h] �������������(���l���������������������Xe�`�`�������h]��������������0�"�xi&������������ xi%���������Ђ��� h]&�������������@�'�ha����zHC �z�0�'�h]����������������@�����^���������������������Xe������`-�����p� �h]1�������������83�:�xi=������������ h]=�������������P�>�ha-����zHC �z83�>�h]����������������P�����^���������������������Xe����Ѕ`D���������h]H����������������K�xiO������������ xiN���������8���� h]O�������������(�P�haD�P��z83�P�bF:,�0�@�V�W!� ��~v�= �(�&�(5@Y���Ƹ‰ H -��~�k�P� -�(:-�����(�z��dЌ� ����nX;�0��Z�FHC �z���P�h]����������������(�����^�������������p������Xe������`V�����X���h]Z�������������Ќ�f�xii����������łh]i������������� �m�haV�Ȋ�zHC �zЌ�m�h]���������������� �����^�������������h�������Xe������`������P�H�h]��������������X;���xi������������� h]��������������0���ha��،�zHC �zX;��� � �0�����x�h]����������������0�����^���������������������Xe�������z�����|p}�@��_�А������|p}��@��_��Ө����`@��_���������������Е��h] �������������@Y� �h]�������������(��xi����������X[�l�����������������xi������������ `o���������'(�h�`�����8�h�h]����������������ha�@�h�HC �z@Y��h]����������������������^���������������������Xe������c�����(���P��h] ���������������!�xi%���������8�� �p"���������2Е�h]*���������������+�p*����������������Xe*�Ȗ`��������p���������`��zx����|p}��@��_�X�x���!��|p}8�@��_�-�Ө����`@��_����������� T�X�*����p�����Щ���������(���������8�`5�����@���h];������������� T�?�h]B�������������(�F�xiF������������`�lF�����������������P�p�h]R���������������S��lG������������������@�h]S�������������X�T�ha5����HC �� T�T�^��������������������Xe������h]`�������������X�d�xii���������p�/� �pe���������-�@�`���������X���������|p}8�@��_����8����|p}أ@��_�r�h�����`@��_���������ȥ��Щ�h]������������� ���n���������5��`��������H��0���P����|p}p�@��_�0�P�p����|p}�@��_��N�����`@��_���������Щ�h]!�������������P�*�h]-���������������.�xi1���������p�� `o/���������&�@�^+���������Щ������Xe!�Ȫf>����h����hg�Ф�H������eW����h����hg\���ȟ������h]s�������������(�v�xi|���������H�� xi{�������������� �pw���������-��`�`��������0�p�г��8����|p}X�@��_��8�X�ذ�|p}��@��_�������`@��_���������������h]�������������� ���xi����������Pj�^������������������Xe�� �h]�������������(� �h]����������������xi���������(�� `o���������&����^ �����������@�����Xe����h����hgo�����������h]'�������������X�+�xi0�����������.�p,���������-(�`�`��������0�����8����|p}X�@��_��8�X�ظ�|p}��@��_�9������`@��_�������������������h]��������������@���xi���������� �xi����������h����p����������-��8�h]��������������@���h]������������������^������������������Xe��0�h]̧������������0�קxiܧ����������pا��������-��л�nا��������5�h]��������������0���xi������������ ^������������������Xe����h����hgȧX�X�p�����hg��������������p�����Щ���������(���������������h] �������������@��xi���������P�(xi�������������0�p���������-��h��n���������5��`��������h����p����|p}��@��_�P�p�����|p}0�@��_��ͨ����`@��_�����������h]��������������0���xiè��������X�8xi¨������������@^������������p�����Xe�����h����hg��� � �����hg#�����0��������(���������P�p�Ȋh�،��@�����Е�������������� �X�������h]ݨ������������@���xi�����������Hxi����������H���P�p����������-���h]��������������(���xi����������Xxi���������P���`�p����������-�� �`o����������`�h�h]O�������������0�Z�xi_���������P�h�p[���������-�� �`o�����������h�h]��������������0���xi����������P�p�p����������-�� �h]Ω������������@�֩h]۩������������(�ީxi����������H�x`oߩ��������'����pש��������-��`�`o©��������h���h]��������������@���h]��������������P��xi������������`o���������&X����p����������- ���`o�������������`oa�����������X�`�������� ����z(����|p}H�@��_��(�H����|p}��@��_� �$�����`@��_���������xi�������������`f����h����hg٨�������������Ё(�8��������h]0�������������(�4�xi4���������8� ��l4����������������������h];�������������@�C�h]E�������������(�H��l5�����������������P���`f)�0�HC �z�(�����h]����������������������ha�������zh]�����������������������v����������^�������������@�x�����Xe�������t������"�(��zp���@��_���������Hz�*����xiT���������������|p}��@��_�������@� ����|p}`�@��_�k�Z�����`@��_����������H -�h��k�P� -���:-��� � �v�= 8F��������x�H��� ����p���HC �� ���������HC �H -���������HC �� -���������8F�x�v�h]l���������������v�HC �8F������h����h]������������������xi�������������p����������-H���h]�������������������n����������8��xi����������������p����������-(�X��n����������5��`o��������������`����������h�������|p}��@��_�������@��|p}`�@��_���1�����`@��_��������� ��h]˪������������x�Ԫh������@�ު��x�����H�xiު����������h��xiު����������h��h]��������������� ��n���������8�xi �������������xi ��������������H�n������������`oު��������&�� �`o���������&`�x�hmǪ�������� �X������s������������Xe��8��h����hg~��P�������h]=��������������\�D��(�p�xiE���������X�`&�h]J���������������T��l=���������������������`f6���HC �������h]���������������������ha����`��h]����������������������v\���������^���������������������Xe������t\�����"�������@��_��� �\�����,�����j(��������(� z�� �������@���xi`���������������|p}�  @��_�����pz�dH& 0�p��|p}p�@��_�u�`� - ����`@��_���������p������������n�H -�x��k�P� -���:-�� T��*��� �0�v�= ���&�(5����X���P���������� H(P�� ���@�HC (�� ���������HC (�H -���������HC (�� -��������� ���z�h]v���������������z�HC (� �����ؤ#P�h�8�h���h]���������������F�������h]�������������������l������������������X���Xe����`��������x�h]�������������������� ��h� ���xi����������P��H�xi�������������� �h���������xi������������G�xi����������P����� ���������xi������������pI�xi�������������������������xi«��������x�K�xiǫ������������H�����������xi˫��������0�hJ�xiѫ��������x����H�����������h� ����� j����������������h]ԫ��������������իha��P�(�HC (���իh]����������������������^��������������������Xe����(�h]߫����������������xi������������X[�l������������������xi��������������p����������-�P�h]�����������������`f�����h����hg۫���(�����`��������h] ������������� T��h]����������������xi���������X��`�l���������������(�����xi#�����������l�����������������p���h]$��������������%�ha��(�HC (� T�%�h]���������������������^������������� (����Xe����X`+������h]/����������������9�h]=��������������A�xiF����������/��pB���������-H�h]M��������������N�ha+�(�Ќ�����n @Y�Ƹ‰ 83��bF:, �������������n�� �0�v�= ���&�(5H -�x��k�P� -���:-�� T��*��H}���S_�0��V�W!����z��d -HC (����N�h]���������������������^�������������(�����Xe����``T�����h]X�������������H}�]�h]X��������������]�haT�P(�HC (�H}�X�h]g��������������q�`��������pP 8(�x ���|p}� @��_�X -x -� - �|p}8 @��_�s�������`@��_���������� h h]{���������������~�xi~���������` �H�l~�������������� 0 xi����������� `&�^����������x � ����Xe{� h]�����������������xi����������� �^����������h � ����Xe��� ��X���P���������� H(P�� h (X@8��0�(P� 8$�%�&�+,`����������(�����|p}�@��_����H�|p}h@��_���������`@��_���������(h]�����������������xi������������^����������(`����Xe���hgc��(X����`Ĭ������h]Ȭ�������������0�ЬxiԬ����������xiӬ��������@���h]Ԭ�������������լhaĬX(�HC (��0�լ���@��p��� h]���������������������^�������������@����Xe����xP�h�8�h���@hx���$�+�X�`۬�����`h]߬������������83���xi���������� �h]�����������������ha۬8(�HC (�83���h]���������������������^�������������������Xe����`��������h]�������������������xi����������0�xi����������x���h]�����������������ha���(�HC (������h]���������������������^�������������0H����Xe����h`������h]�������������Ќ��xi����������łh]���������������ha��(�HC (�Ќ��h]���������������������^�������������(X����Xe����``!������$h]%�������������@Y�&�h])���������������-�xi-����������X[�l-�������������P�xi7���������@ �`o5���������'� h]7��������������#8�ha!�� (�83��bF:, @Y��#Ƹ‰ ���&�(5 T��*��Ќ�����n �������������n�� �0�v�= �0��V�W!H -�x��k�P� -���:-��H}���S_����z��d -X;�&�Z�F HC (�@Y�8�h]�����������������#����^�������������8$X ����Xe����p$`������ %h'h]��������������X;�ĭxiǭ���������%�h]ǭ������������&ȭha���%(�HC (�X;� ȭp����@��p��� �%h]����������������&����^��������������&`%����Xe����'(�)���|p}0)@��_��)*�[!�*�|p}�*@��_���������`@��_����������-�+,�,�102 34�9�>?�@�F�G�G8I�N�c������(-P,-h]���������������#��h]������������������p����������2�+,h]���������������#��p������������,����Xe���,`��������p-4�@Ip[�'x/���|p}�/@��_�X0x0�R!1�|p}81@��_���������`@��_����������U�102 34�9�>?�@�F�G�G8I�N�OP�Ph]�������������� �h]����������������xi����������2�`�l�������������02h23 3h]��������������#��l������������������2�2^ ����������1X3����Xe��3h],��������������0�xi5����������4/��p1���������-4P4`�������� 5h@�@�-(7���|p}H7@��_�8(8H8�8�|p}�8@��_�>�4�����`@��_����������:�9�>?h]Ӯ�������������߮�nҮ��������5�9`��������X:(@@@�5`<���|p}�<@��_�@=`=�=>�|p} >@��_��������`@��_����������>?h]�����������������h]���������������#��xi�����������?�`o����������&?P?^�����������>�?����Xe���?f -��+�h����hgή�9:X@�����e#��+�h����hg(��4�4�@����h]?��������������B�xiH���������XA�xiG����������A���pC���������-�@pA`��������@B�G�H�-HD���|p}hD@��_�(EHEhE�E�|p}F@��_�K�������`@��_����������F�G�Gh]���������������¯xiů��������Pj�^ï���������FG����Xe��0Gh]ԯ�������������ׯh]گ�������������#ۯxiޯ��������8H`oܯ��������&�GH^د���������GPH����Xeԯ�H�h����hg;��A�A�H����h]�����������������xi�����������I.�p����������-8IpI`��������@J�R�-HL���|p}hL@��_�(MHMhM�M�|p}N@��_��Ͱ����`@��_����������N�OP�P�Qh]^��������������f�xil���������0Oxik���������xO�� �pg���������-�NHOh]y����������������h]���������������#��^�����������OP����Xey�@Ph]��������������&��xi����������Q(�p����������-�P�P�n����������5(Qh]��������������&��xið��������R0^�����������Q�Q����Xe��R�h����hg��hQhR�R����hgZ��O�P�R�����102 34�9�>?�@�F�G�G8I�N�OP�P�Q�SZh]װ�������������߰xi����������`T8xi�����������T��@�p����������-�SxT�n����������5�T`��������xU[�-�W���|p}�W@��_�`X�X�X Y�|p}@Y@��_���������`@��_���������Zh]��������������&��xi����������hZHxi�����������Z��P^����������Z�Z����Xe���Z�h����hgӰU0U0[����hg���I�I@[�����+,�,�102 34�9�>?�@�F�G�G8I�N�OP�P�Q�SZ��X���P���������� H(P�� h (X@8��0�(P� 8$�%�&�+,�,�102 34�9�>?�@�F�G�G8I�N�OP�P�Q�SZ�^�_ab�bcHd�d�j�p�qr�r�sh]�����������������xi����������(_Xxi����������p_��`�p����������-�^@_h]ı�������������DZxiͱ��������0`hxi̱��������x`��p�pȱ��������-�_H``o�����������_�`h]�������������&&�xi+���������xax�p'���������-aHa`oϱ���������`�ah]|�������������&��xi����������xb��p����������-bHbh]�����������������h]�����������������xi����������pc�`o����������'c@c�p����������-�b�c`o�����������b�ch]���������������òh]Ȳ�������������ѲxiԲ���������d�`oҲ��������&�d�d�pIJ��������-Hde`o����������d@e`o-����������a�e`��������Hf@z(�Ph���|p}ph@��_�0iPipi �i�|p}j@��_�ز������`@��_����������l�j�p�qr�r�s�tv�v�w�x�xh]�����������������xi����������8k�xi�����������k����p����������-�jPk�n����������5�k`��������Plz�fXn���|p}xn@��_�8oXoxo �o�|p}p@��_���������`@��_����������p�qr�r�s�tv�v�w�x�xh]����������������xi ���������@q��p���������-�pqh]���������������`o���������Xq�qh]'���������������*�xi*���������xrpI�l*�������������rHrh]2���������������5�xi5���������8shJ�l5��������������rsh]=���������������A�xiA����������s ��lA��������������s�s`t�t�txiH����������t�h]K��������������N��lB�����������������tPt^;���������Psu����^0����������rXu����Xe'��uh]h���������������k�xik���������xvpI�lk�������������vHvh]s���������������v�xiv���������8whJ�lv��������������vwh]~�����������������xi�����������w ��l���������������w�w`x�x�xh]�����������������h]������������������l������������������xPx^|���������Pw�x����^q����������vHy����Xeh��yhg���q�u�y�����h����hg���kl0z������X���P���������� H(P�� h (X@8��0�(P� 8$�%�&�+,�,�102 34�9�>?�@�F�G�G8I�N�OP�P�Q�SZ�^�_ab�bcHd�d�j�p�qr�r�s�tv�v�w�x�xx�8���@�x�p�0�h�0�������З���� ���؜�8�������p�����`���������~����(������|p}�@��_�؁��X�!���|p}��@��_���״����`@��_���������(�x�8���@�x�p�0�h�0�������З����h]���������������³xidz������������pó��������-x���h]̳�������������ֳ`oɳ����������8�`����������X�H�p����|p} �@��_���� ����|p}��@��_�س4�����`@��_�����������@�x�p�0�h�h]������������������xi������������hJ�l������������������h]������������������xi������������ ��l��������������@�x��0�x�xi����������`��h]�����������������l���������������������^�����������������Xe���h]����������������xi���������،pI�l�������������p���h]����������������xi����������� ��l�������������0�h�� �h�xi$���������P��h]'��������������*��l���������������������^�����������������Xe���`������������ؙp�����|p}Б@��_�����ВP��|p}p�@��_�:�������`@��_���������0�������З����h]D���������������G�xiG�����������hJ�lG�������������0�h�h]O���������������S�xiS���������X� ��lS���������������(������h]Z��������������c�h]e��������������m��lT�����������������p���^M�����������P�����XeD���h]x���������������{�xi{���������x�pI�l{��������������H�h]������������������xi����������8� ��l��������������З�������h]�����������������h]������������������l������������������P���^������������0�����Xex���hg��p���`�����h]������������������x�8���@�x�p�0�h�0�������З���� ���؜�xi������������K�l�������������� �`�h]������������������xi����������P� ��l���������������� ���؜�h]´�������������ʴh]̴�������������ϴ�l������������������h���^������������H�����Xe����hg���ef�~����h]�����������������xi��������������p����������08�p�h]������������������xi����������`��G�l����������������0�h]����������������xi��������� � ��l���������������������p�xi ���������ؠ�h]���������������xi���������X��`o���������'��(��l�����������������8�x�^����������x�������Xe���h]+��������������5�h]=���������������@�xi@�����������G�l@�����������������xiG�����������`&�^E���������(�h�����Xe=����h����hg'�p�������hgݴ��X�(�����h]X���������������[�`fQ���@�P�h�8�h���@hx���$�+�X���HC (��� -����h]����������������������ha����8�(�h]�����������������������vg���������^���������������Ȧ����Xe�������tg�����"��(����@��_�������g���X�.����xif�����P��E�xik� ������`&� �h���������xir�#������:](� �V�~�xi}�&������(�بX���������xi��)�������]�xi��,������ȩ���������xi��/�������xi��2������h����������� j5������@����h]���������������ha'�X���HC ��� -��^����������X������Xe������h]��?������������xi��<����Ȭ�]�l��9��������`���h]��L����������xi��I�������]�l��F�������� �X�h]��O��������ŵ^��B��������0^��5�������2Xe��h�h]ǵ\����������̵� � �� ������p�hF�Āh?�PY��X�`� ���Ю��X�H�ȳ��(���xi̵Y����@��l̵V��������Ю�h]յi��������ڵxiڵf������lڵc����������аh]��l������������^��_�����X�4^ӵR����X���6Xeǵ��h]��{����80���platform]0����-��xi��x��������l��u����:H���xi�~����p��]��p�r����-�@�h]����������h��xi������0�� �l����������ȳ�h]!����������&�^������H�������������>Xe/� �hg�����p�o�t ����d��������@��_���0�0�Xe���t������������ ���@��_��������HC ��� �����h]���� �������������^��������X�������h]K��������������`fK���HC ������������HC ��(D���������HC ��H ������������P���.this_function]�H��s�p~�pK��K�L�xM��M�8O�8R��S��T�Z� �� -���ɀ`ɀ�ɀ�ʀ(ˀh̀(πPЀ`р`ր �� -`D��D��D��F��F� I�@M�0��c�Xc��c� f�ph��j�`s��{�X����� ��� -@�� x�� �ς ҂�}��9�@:��:��;��>�B��F��H�J�b� e� -(�� (� HL��L��L��M� Q��U�����z�8{��{������@��`��@��ؤ�0�� �-�0.�x.� 0�h0�7�<�XF��V��i� l� -h|� H�� p�� @�����������P��p3��3�4�5��@��I� �h���������x������������� ��� -��� @@� Ї�H��� �0n�xn��n��o�@p�0w�{�}��~���� ��� -�M�-�X-��-��.��1�@4�8�:�`<��C� ���Ѝ��������Ȥ�����0����� ��x��p��h�� h�� -� �� P� ������P�!�#P%P-�6@o�o�o�pXw|����0�0��X������h����H���������(�8�h� ( -P � � - hN�R@ap�����h�����������������@ ����0�h���P�(� ����� �� -X��~�~((�@�P�(� �0��� �h�����0�x������������ � -� �# & � �x -� ��� �h�0�x����F� pĀ -�?� �\�  ��0�x����� �h�0�x����F� pĀ -�?� �\�  ���0�x��� diff --git a/Chapter03/working-with-files/file.dat b/Chapter03/working-with-files/file.dat deleted file mode 100644 index 69d5e4d..0000000 Binary files a/Chapter03/working-with-files/file.dat and /dev/null differ diff --git a/Chapter03/working-with-files/incremental-processing/clean.dat b/Chapter03/working-with-files/incremental-processing/clean.dat deleted file mode 100644 index 5ff558c..0000000 --- a/Chapter03/working-with-files/incremental-processing/clean.dat +++ /dev/null @@ -1,122 +0,0 @@ -��b�6(�d(�����%(�%(����h]k�������������0��2(��|p}82(P��_��2(3(xc(!�3(�|p}�3(P��_��v�y3(�����������P��_�i���������9((2(h]{�������������|�ha@2( ( (�i|������������������2(����^�������������4(�4(�6(�=(�>((D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(p}05(���_�6(06(�6(p}�6(���_�����h]w������������x��wh] w�������������� wxi w��������85(��l w�������������4(5(�5(�5(xiw���������5(8 �lw����������������P5(�5(A(^w���������4(6(����Xew`6(h])w��������������-wxi-w��������07(��l-w�������������6(7(�7(�7(`�7(xi9w���������7(����@ �l.w����������������H7(�7(�xi@w���������8(:H �p(Hc(X (�"(�0(x2(�8(�B(h]�����������������0(0;(��|p}P;(P��_�<(0<(@b(!�<(�|p}�<(P��_�Iw�y$(�������P��_��������������Y(���������8(p����������� ;(Xe��`���������@(�D(�F(�=(�>((D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(�](�^(`_(�>(?((?(�|�?(��h]Uw��������_���� ��\wxi_w��������>(P ^]w���������=(�=(����XeUw0>(h]pw���������������swxivw��������?(X �ptw��������(0�>(�>(`���������?(@F(�X(�9(�A(��|p}�A(P��_��B(�B(�B( HC(�|p}hC(P��_�ywy]�������P��_���������������H(��l���������������A(������(B(�@(�����������A(h]���������������B(��ha��(D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(h]�����������������B(����^�������������@B(����XeXC(h]�����0(�������������8(h]�w�������������x���wh]�w���������������w����xi�w���������D(��l�w������������`D(�D(0E(PE(�2(��h]xi�w��������(�E(����` �l�w�����������������D( E(����^�w������������(D(�E(����Xe�w�E(h]�w������������x���wxi�w��������(�F(/h �p�w��������(-XF(�F(h]�w������������x���wxi�w��������(�G(\p �p�w��������-G(PG(`o�w���������F(�G(`��������`H(��V(�W(�X(�H(���l������������� H(XH( @(hJ(��|p}�J(P��_�HK(hK(�K(L(�|p}(L(P��_��wy}�������P��_�L(��������pN(�M(p} M(���_�#�������������_������Q(�L(xR(8S(�S(�V(W(�W(�k�P�"pN(:-���P�O(R�q �!�M(v�= �O(V�q$�O(�O(8O(�P(�U(XW(@X(�Y(h]�w����������������wxi�w��������PM(x �p�w��������-�L( M(`���������M(C pV(�V(��������HC �I(H"���������H(�O(��|p}P(P��_��P(�P(Q(�Q(�|p}�Q(P��_��w�xO(�������P��_����������I(��'HP(�Y(�Z(h]�����O(;���������Q(�V(�W(xR(8S(�S(�V(�I(S(��|0S(�S(�T(�|p}���_�h]wx������������0��zxxizx����������R(�����>lzx������������xR(�R(h]�x������������0���xxi�x���������S(�=l�x������������8S(pS(h]�x���������������xxi�x��������`T( Sl�x�������������S(0T(�T(�T(0U(xi�x��������U(� xi�x��������`U(� �l�x����������������xT(�T(i^�x���������S(xU(��������^�x���������R(�U(����Xewx V(h]�x�������������0���x`f�x�V(�h����hg�whM(�M(�V(��������h]�x������������p���xxi�x������������^�x��������W(PW(����Xe�x�W(h]�x������������� ��yxiy��������PX(� ^y���������W( X(����Xe�xhX(�h����hg�w�G(H(�X(��������`��������XY(�a((b(Y(�Y(����`o����������&�X(Y(Xet��9(`[(��|p}�[(P��_�@\(`\(�\(](�|p} ](P��_�%y�y(��������P��_������������������������G(�G(��X[(����������(xi������������l���������������[(\(�](�^(`_(�a(����������(���p����������-H\(�\(�n�����������\(h]����(���(�(�( (p"(�%(h0(@2(�8(�B(h]�y������������0���yxi�y��������(H^(�>l�y�������������](^(h]�y������������0���yxi�y��������_(�=l�y�������������^(�^(h]�y���������������yxi�y����������_( Sl�y������������`_(�_(0`(P`(�`(^������xi�y��������(�`(� xi�y��������(�`(� �l�y�����������������_( `(�� ^�y�������� _(�`(�����^�y��������`^(8a(����Xe�y�a(h]�y������������0���y� `f�y�a(�=(�>((D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(�](�^(`_(�a(�����b(�+l��� ������b(�b(xihglw?(X?(Y(�����4(�4(�6(�=(�>((D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(�](�^(`_(�a(����0d(�+l�� ������c(d(�h����hg%w�8(�8(�d(����8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�����0�h��@������,�x-�x.�8/��4(�4(�6(�=(�>((D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(�](�^(`_(�a(l@� ������f(�f(xiJ� �����g(���lJ�� �����@g(�g(^4�� �����f(�g(�Xe�h(h]x� ����������'��xi�� �����h(�+l�h����hgsv�80�x0��h(����royShg�p������i(����إ������ج�x����`��x��8��ر�H��h����� ����������������8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�إ������ج�x����`��x��8��ر�H��h����� ����������������8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�����0�h��@������,�x-�x.�8/��4(�4(�6(�=(�>((D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(�](�^(`_(�a(�o(xp(Hv(w(�w(@y(�z(H{(|(@}(�(0�(��(@�(��(0�(��((�(P�(��(8�(��(H�(H�(��(��(`�(��(��(��(@�(�(H�(��(X�(0�(h]z������������x�� zxiz������������ p(/� �p -z��������-�o(�o(h]z������������x��zxi"z��������(�p(\� �pz��������-xp(�p(`oz��������8p(�p(`���������q(�(y(xy(����HC �k(p�����x���s(��|p}�s(P��_��t(�t(�t(hu(�|p}�u(P��_�+z�z����������P��_���������h]����������������h]�����q(�������������o(��`��h]����������Hv(w(�w(@y(]�u(�5Ou(h]���������������o(���D&����������r(�D&h]����������������h]����h]�z������������0���zxi�z��������(�v(�>l�z������������Hv(�v(h]�z������������0���z����xi�z��������(pw(�=l�z������������w(@w(h]�z����������������zxi�z����������0x(� l�z��������������w(x(^�z���������w(Hx(����^�z���������v(�x(����Xe�z�x(h]�z������������0���z`f�z@y(�h����hgzQ 8q(xq(�y(����hg�p(��h���y(����������������x����`���y(H~(x~(Ѐ(��(Ј(Ȋ(؍(��(h]�z������������� ���zxi�z�����������z(� �p�z��������(0�z(�z(h]�z������������0���zxi�z���������{(�>l�z������������H{(�{(h]�z���������������zxi�z��������p|(l Sl�z�������������|(@|(�|(�|(@}(�|(xi�z��������(}(����� h]�z������������ ��{Z �l�z�����������������|(�|(^�z���������{(x}(����Xe�z�}(�h����hg�z{( ~(8~(����` {�����~(� ��(h]{�������������0�{xi{���������0(y � xi{��������x(��� h]{�������������({ha {�(x��HC x���0�{h]�����������������(����^�������������0�(H(����Xe�����h�(`"{�����(ȅ(h]&{�������������83�/{xi2{����������(� h]2{��������������(3{ha"{��(x��0�(x�(Є(@�(83���(bF:, ��(X�(0�(h�(Ȝ(�( 6��&�(5@���(Ƹ‰�� �����K �x��*����h��n�0 Ќ���(���np(�!��������؞���2�~�p(H"���������0��(V�W! ��0�������!���v�= ��p���n�H"Ȥ��k�P�"��:-��(�h���`� -���P�(z��d X;��(�Z�F��������HC x��83�3{h]������������������(����^�������������@�(X�(����Xe��������x�(`9{����(�(��(h]={���������������@{xiD{��������(��(� xiC{��������(��(��� h]D{������������P�(E{ha9{��(x��HC x����� E{P)��p�����X��P��H��H���(؁(0�(��(Ќ(��(h]����������������P�(����^�������������0�(��(����Xe����h�(`K{�����(-����(h]O{������������Ќ�[{xi^{��������(��h]^{��������������(b{haK{��(x��HC x��Ќ� -b{h]������������������(����^�������������(�(X�(����Xe����`�(`h{�����(��(h]l{������������@�m{h]p{��������������t{xit{����������(X�lt{������������P�(��(xi~{��������@�(� `o|{��������'Ћ(�(h]~{��������������({hah{��(x��HC x��@� {h]������������������(����^�������������8�(X�(����Xe����p�(`�{���� �(Џ(h]|������������X;� |xi|����������( -h]|�������������(|ha�{��(x��HC x��X;� |h]�����������������(����^�����������������H�(`�(����Xe����������(����x��x�(��|p}��(P��_�X�(x�(�(!�(�|p}8�(P��_�2|��������P��_���������X�(p}��(��(x�(�|p}���_�a�������H�(��(��(`�(��(��(��(@�(�(H�(��(X�(0�(�(8�(��(�c.|������(��(x�(h]5|��������������(6|h]:|������������ ��A|�p7|��������2H�(��(h]E|��������������(F|pE|�����������(����XeE|0�(`������������ؕ(^h�((�(p�(��(��(����Xei�ȕ(h]����������������(��(��|p}�(P��_���(��(X�(!��(�|p}��(P��_�H|�(�������P��_���������-`�(p�(`@�(��(��(H�(��|p}h�(`�(��(��(��(@�(�(H�(��(X�(0�(�(8�(��(0�(8�(p�(�|p}�(���_���������������_�����h]P|������������x��T|h]W|��������������[|xi[|���������(��l[|��������������(К(h�(��(�(h]g|��������������(h|�l\|�����������������(X�(^U|��������`�(��(����XeP|�(h]u|������������x��y|xi~|����������(����/ -�pz|��������-��(��(h]�|������������x���|xi�|��������(��(\ -�p�|��������-@�(x�(`o�|���������(��(`����������(Щ(�(p}�(���_�Р(��(�(��(X�(��(��|p}��(P��_�p�(��(��(0�(�|p}P�(P��_��|�}�������P��_���������@�(�(H�(��(h]������������������(�(Bad argu]�آ( h]0}���������������(<}�n/}��������5�(`����������(�����(��(����`�(Xe����(hg����(��(��(����hgC��(ȥ(��|p}��(P��_���(Ȧ(��(h�(�|p}��(P��_�>}w}(�(�������P��_��(����������(x�(��(��(�(�(@�(p�(h�( -�������������ؤ(Xe -�H�(h]W���������������(H�(��(P���������8��(xi`���������P�(�A��p\�����������( �(`����������(h]J}��������������(S}h]V}��������������(W}xiZ}����������( -`oX}��������&��(��(^T}��������H�(�(����XeJ}@�(fg}��(�h��������hg+}H�(x�(��(�����e�}��(�h����hgq|�(@�(�(����h]�}������������P�(�}xi�}����������( -xi�}���������(��( -�p�}��������-X�(ت(`����������(��(H�(X�(��(��|p}Э(P��_���(��(Ю(P�(�|p}p�(P��_��}E~�����������P��_��(����������������������(h]�����������������l��������0�(^u���������x�(�(����Xep�h�(0�(�(8�(L�h�(��(Ю(����h]���������������)��xi�����������0�l��������������H�(��(��(��(����������x�(h]~���������������(~xi"~������������P`^ ~��������0�(h�(��������Xe~��(h]1~������������P�(4~h]7~���������������(8~xi;~������������(0 -`o9~��������&8�(p�(^5~���������(��(����Xe1~��(�h����hg�}���� �(`�(`�(����h]P~������������x��T~xiY~���������(.8 -�pU~��������-��(ز(`����������(|(�(���_�ص(��(�(��(X�(��(��|p}е(P��_���(��(ж(P�(�|p}p�(P��_�b~*�������P��_���������h�(0�(8�(p�(�(�(h]����������������xi������(l����x�(��(h]�~�������������(�~xi�~��������������(@ -xi�~��������(��(��H -�p�~����������-0�(��(h]�~�������������(�~h]�~��������������(�~� ^�~��������8�(p�(�����Xe�~��(h]�~�������������(xi��������x�(P -�p��������(-�(H�(�n��������5��(h]�������������(xi ��������h�(X -^���������(8�(����Xe��(�h����hg�~к(л(��(����hg�~��(��(��(����`�(��(��(��(@�(�(H�(��(X�(0�(�(8�(��(0�(8�(p�(�(�(`�(h�(�3�@@��O��Y�Xi�xs�H��������������P�� h]4�������������(<xiB��������!Ƚ(` -xiA��������"�(��h -�p=��������$-`�(��(�n=��������%5(�(`����������(+&��(@�&��& '0F'�P'�R'�S'�'��'��'hb(`e(Xh(�k(�y(X�(��(��|p}�(P��_���(��(�(��(�|p}��(P��_�E��������P��_���������h�(h]��������������(�xi�����������(p -xi��������������(��x -^���������h�(��(����Xe��0�(�h����hg0� h�(��(��(����hgL~ �(`�(��(����H�(��(��(`�(��(��(��(@�(�(H�(��(X�(0�(�(8�(��(0�(8�(p�(�(�(`�(h�(8�(�|p}x�(إ������ج�x����`��x��8��ر�H��h����� ����������������8��������������������p�����������������`������������������8�������������������������(��������������8��p��(�`�`��� �x�������X�����0�h��@������,�x-�x.�8/��4(�4(�6(�=(�>((D(`D(XF(G(�L(xR(8S(�S(�V(W(�W(�](�^(`_(�a(�o(xp(Hv(w(�w(@y(�z(H{(|(@}(�(0�(��(@�(��(0�(��((�(P�(��(8�(��(H�(H�(��(��(`�(��(��(��(@�(�(H�(��(X�(0�(�(8�(��(0�(8�(p�(�(�(`�(h�(��(��(��(��(��(��(�(H�(��(��(`�(��(��(X�(H�(��(��(��(H�(8�(p�(��(��(�(��(��(��(��(��(��(��(��(P)@)x)p)0) )X)�)H)8)p)� -)p )0 )h )�) )�))�)h]K�������������8�(O�`����������(X�(0�(��(��|p}�(���_���(��(�(��(�|p}��(���_�Q�x�h]��������������(�����xi�����������(� -xi���������8�(��� -�p���������-��(�(h]!�������������P�($�xi*�����������(� -xi)���������@�(��� -�p%���������-��(�(`o���������P�(X�(h]x��������������(��xi����������@�(� -�p����������-��(�(`o,�����������(X�(h]ـ�������������(������xi����������@�(� -�p����������-��(�(h]���������������(��h]�������������P�(�xi -�����������8�(� -`o���������'��(�(�p���������-��(P�(`o����������X�(��(h]��������������( �h]%���������������(.�xi1�����������(� -`o/���������&H�(��(�p!�����������-�(��(`o �����������(�(`o������������(H�(`���������(^��(������(�(�Xe��(h]��� ��������x���(��|p}8�(P��_���(�(8�( ��(�|p}��(P��_�5� -�(�(�������P��_��(����������(X�(��(�|��(*�����������_�����������(��(`�(��(��(X�(H�(��(��(��(H�(8�(p�(�"H�(:-���!v�= `�( �(��(��(h]A�������������P�(D�xiJ����������(� -xiI���������H�(��� -�pE���������-��(�(�nE���������(5`�(`�������������(�(��(��������HC ��(�"����������( �(��|p}@�(P��_��( �(@�( ��(�|p}��(P��_�M���(�������P��_���������h]�����������)����������(�z����������� �(��(��(h]����������������(��(`�(��(��(X�(H�(��(��(��(H�(8�(p�(���������(H�(�l����������������(��(����(����hg��((�(����h]����h][���������������(d�xii����������(����� -�pe���������-��(��(h]n�������������p��x�`ok��������� �(`�(h]��������������0����xi����������@�(p?l����������������(�(h]��������������0����xi����������(�(h@l�����������������(��(h]����������������������xi������������( Sl��������������X�(��((�(H�(��(h�(h]�������������� ����h]��������������P�(���l��������������������(�(e^�����������(��(����^����������X�(�(����� Xe��`�(h]ˁ������������0��΁xi΁��������0�(� p?l΁��������������(�(h]ց������������0��فxiف����������(� h@lف��������������(��(h]������������������� xi����������(��( Sl��������������H�(��(�(8�(p�(����h]����������������(���h]��������������P�(���l����������(����������(�(^߁���������(��(����^ԁ��������H�(�(����XeˁP�(hgW� ��(��(��(�����h����hg=���(��(��(����`��������p�(����X)P )|�@�(HC ��3��������HC ���x��x�(��|p}��(P��_�X�(x�(P)!�(�|p}8�(P��_��F������������P��_�����������(ҏ�uإh�(����( U&(�(����(����(��&H$��(���(��}6� �P�(�A�������(*� � �3��(��(�(��(��(��(��(��(��(��(��(P)@)x)p)0)������������ ����������������������pN"h]���������������(%�xi*�����������`�(� -�p&���������-��(0�(h]/�������������p��9�`o,���������x�(��(`��������x�(�(��(��(�A�������(*� � pN"��(��b -��(��(��|p}��(P��_�`�(��(��( �(�|p}@�(P��_�;����������P��_���'����������&����������%(������������С.this_function]�P�(�s�`��(��(��(��(��(��(��(��(������@�x�p  -P�����hP0h]E�������������0��H�xiH���������h�(h@lH��������������(8�(h]P���������������T�xiT���������(�( SlT���������������(��(��(��(��(@qh][������������� ��b�h]d��������������(l��lU�����������������@�(��(�^N�����������( �(����XeE�x�(h]w�������������0��z�xiz���������H�(p?lz���������������(�(h]������������������xi�����������( Sl����������������(��(p�(��(��(�רh]�������������� ����h]��������������P�(���l������������������� �(`�(��^����������`�(�(����Xew�X�(`���������(X)8)�.�(/�p/� 1�h1��1�(7���(�(��|p}0�(P��_���(�(0�(��(�|p}��(P��_����֩�������P��_�©��������h�����0��x��h�����`��������H�H�����P���(P)@)x)p)0) )X)X1�X2��3��4��7��\��M� N�P�XP�hj��j�0l�xl�h]��������������0����xi������������(h@l����������������(��(h]����������������‚xi‚���������) Sl‚������������P)�) )@)x)��h]ɂ��������������(҂h]Ԃ�������������(܂�lÂ������������������))��^����������)�)����Xe��)h]��������������0����xi�����������)p?l��������������p)�)h]������������������xi�����������) Sl��������������0)h)) )X)PI�h]����������������(�h]�������������P�( ��l��������������������)�)%�^�����������)�)����Xe���)��(��(�(��(��(��(��(��(��(��(��(P)@)x)p)0) )X)�)H)8)p)����H��������ؤ�hg���(0�(��(����h]�������������0���xi�����������)Al��������������)�)h]&���������������*�xi*�����������) Sl*�������������H)�))8)p)(;�h]1��������������(9�h];�������������P�(>��l+������������������))^$���������)�)����Xe� )hg���(��((�(���� )������������x����`���y(H~(x~(Ѐ(��(Ј(Ȋ(؍(��(h )P)�)p����X�������� ����h]P���������������(Y�xi\��������� )� -�pZ����������0� -)� -)h]e�������������0��h�xih���������� )�=lh�������������p )� )h]o���������������s�xis���������� ) Sls�������������0 )h ) ) )� )@c�xiz����������P )� -h]}���������������(��xi������������ )� -`o����������'h )� )�lt������������������ )� )^m���������� )()����Xee��)h]��������������p����h]��������������0����xi�����������)�=l�������������� )X)h]������������������xi����������H) Sl���������������))�)�))�- xi���������� )� -h]ă������������ ��˃�l���������� ��������`)�)v ^�����������)P)����Xe���)�h����hg���)�))����hgL�0 )�) )����h]ڃ������������0��݃`fӃ�)HC x���� ����h]�����������������)����ha����)x��h]�����������������)�����v�o��������^�������������p)�)����Xe�����)�t�o�����"��x��X���P��_��)�)�)�o�"!0��8)����xi�������!0)�;xi�������x)g)H)��������delimiterG!]��) ���Cxi�������()�);�!]�@)�g;�xi�������)H)�)x)��������xi������)�Sxi������!���)0)��������posix]��!�)�DA"xi������!�)�)xi���������))�������� j�K����!T����h]"�H��������)#�ha��)�HC ��S #�^����D������)`)����Xe����P)`'��) "H�,h]-��������������)2�H�+�j)(�)��)�)xi[������"�)HT�@)HT�|p}�+)P��_� )@)R)C'�6) �)@i))�|p})P��_�t����"�������P��_��"���������c)��"�_�#)��v@�Ƹ‰H")�k�P�"P):-���P%)�s��"�!�)v�= `>��!)N�����"��"`�"��"8!)�!)0#)�#)�$)x+)(6)�))�-)�.)�/)80)7)�7)8)@8)p!)h#)0%)�+)�\#�\#`^#�^#e#�#H#(#HC �)�!��������HC �)H"����HC �)�"����������#��# H�# -��# 0�# ��# �#h�#( )j)h )x")p$)8.)�T)�h)`�#`}������ )$`")h]��������������`>���xi����������$ !)�h]���������������!)��ha}�8!)�)HC �)`>���h]�����������������!)����^��������������!)� )����Xe����")`�������")�$X$)h]���������������_��xi����������$P`h]���������������#)��ha��0#)�)HC �)�_��h]�����������������#)����^��������������#)#)����Xe����$)`�������$)h]�����������������h]��������������P%)��ha���$)�)HC �)����)(')��|p}H')P��_�()(()�N)!�()�|p}�()P��_�̄��&�������P��_����������1)�f&8g&�0&@1&x2&�&P�&Ѕ&�&py&�y&�{&`�&��&�))�-)�.)�/)80)7)�7)8)@8)�=)(>)�>)�>)�@)A)�A)(�&p�&��&��&��&��& '�'�<' ='h]ф������������@�҄h]Մ������������)ބxiބ��������H*)X�lބ�������������))*)xi����������'�*) `o����������'`*)�*)`̈́����p+)�' .)h]��������������P-)��hä́x+)�%)��'0�'�P%)�s�0�'��'л'�_�#)��v@�P-)Ƹ‰�!�)v�= 6�6)&�(5H")�k�P�"P):-����'��'`>��!)N���@�'HC �)@���h]����������������P-)����^��������������-)�*)����Xe�����-)�cȄ�����0)(+)�/)�0)h]��������������P-)��xi����������(�.) xi����������8/)�� �p����������(2�.)/)h]���������������#)��n����������5�/)`o����������P/)�/)h] �������������P-) -�p -����������80)����Xe -�p0)`��������1)�5)�A)�B) I)K)�N)DxG�L�O�R�%) 3)��|p}@3)P��_�4) 4)`K)!�4)�|p}�4)P��_�������������P��_�I����������D)1 ��23x����56P��(� 89X #Xf$;<�%&>�&?Xq&@��'A( (B7)�7)8)@8)�=)(>)�>)�>)�@)A)�A)8B)�B)PI)�I)HJ)�(P�( ��((�( ��(`������5)h]������������� 6�h]��������������6)�ha�(6)�1)HC �) 6�@i)p!)h#)0%)�+)`6)h]*�������������P-)+�xi/���������x7) �p,���������27)H7)h]:��������������6)>�h]A�������������)J�h]K�������������P-)L�lJ�������������8)@8)^?����������7)x8)����Xe:��8)`��������h9)�@)�A)�O�R�\�_cj m�1)p;)��|p}�;)P��_�P<)p<)�<)=)�|p}0=)P��_�Z���|��������P��_��������������6P��78�\"X #:;h�$�%=>�&Xq&@A( (xw(Cp�(��(�=)(>)�>)�>)�@)A)��(��(��(�(P�(��( ��((�( ��(h]h�������������P%)k�h]p���������������,y��pl���������-�=)(>)h]��������������P%)��h]��������������0�,��xi����������@?)�l���������������>)?)�?)�l������������������X?)�?)^�����������>)�?)����Xe�� @)�h����hgd�`>)p@)�@)����h]���������������6)��h]��������������P%)��^�����������@)A)����Xe��8A)hg&��7)9) 9)����h]��������������ȖDžB)8B)h]ȅ�������������6)̅�l�������������������A)B)Xe��pB)h]���������������6)��xi����������HC)X�l���������������B)C)xi����������C) �p���������-`C)�C)`��������pD)�H)�1)xF)��|p}�F)P��_�XG)xG)�G)H)�|p}8H)P��_� �$��������P��_����������e�8.)�h����hg���C)(D)I)����h],��������������!)8�h];��������������6)?�xiB����������I)``o@���������&�I)�I)h]H��������������!)T�`oF���������&J)HJ)^9���������PI)�J)����Xe,��J)h]\��������������#)l�7)�7)8)@8)�=)(>)�>)�>)�@)A)�A)8B)�B)PI)�I)HJ)(K)hL)h]o��������������6)s�xis����������L)��ls�������������hL)�L)8M)XM)xi����������M)( �lt������������������L)(M)xi����������(N)/0 �p����������-�M)�M)^m���������(K)@N)����Xe\��N)�))�-)�.)�/)80)7)�7)8)@8)�=)(>)�>)�>)�@)A)�A)8B)�B)PI)�I)HJ)(K)hL)8!)�!)0#)�#)�$)x+)(6)�))�-)�.)�/)80)7)�7)8)@8)�=)(>)�>)�>)�@)A)�A)8B)�B)PI)�I)HJ)(K)hL)�P)0Q)�Q)h]S��������������!)_�h]b��������������5v�xQ)�Q) T)h]w��������������!)��h]���������������#)��8!)�!)0#)�#)�$)x+)(6)�))�-)�.)�/)80)7)�7)8)@8)�=)(>)�>)�>)�@)A)�A)8B)�B)PI)�I)HJ)(K)hL)�P)0Q)�Q)�Q)U)Z)�[)�\)�b)�n����������5�Q)�lb�����������������0Q)hQ)^`����������P)PT)����XeS��T)h]���������������#)��`���������U)�\)�)�W)��|p}�W)P��_�xX)�X)�X)8Y)�|p}XY)P��_��� ��������P��_���������Z)�[)h]���������������!)̇xi̇���������Z)X�l̇������������Z)PZ)xiև��������[)8 �pԇ��������0�Z)�Z)xi�����������[)`h]���������������!)��`o����������&`[)�[)`f���[)xi���������h\)``f�8\)hg�� [) \)�\)����h]*��������������!)6�xi6���������0])X�l6��������������\)])xi@����������])@ �p>���������0H])�])`��������X^)c)�)``)��|p}�`)P��_�@a)`a)�a)b)�|p} b)P��_�C�e��������P��_����������b)h]R��������������!)^�`fK��b)`��������xc)Hh)�)�e)��|p}�e)P��_�`f)�f)�f) g)�|p}@g)P��_�k����������P��_���������xiz���������0h)(2�`fs�h)hg&��])^)0c)����hg��U)HU)`h)����HC �)HT����h]�����������������h)����ha����i)�)h]�����������������h)�����vd���������^�������������`i)�i)����Xe�����i)�td������"HT�) )�P��_��j)�j)�j)d�p)(j)����xi������� k)x5���l)x5��|p}�l)P��_��m)�m)�)!`n)@o)��)�|p}�n)P��_������������P��_�����������Xw)�n�H"�o)�k�P�"�o):-�����|)���~�!@o)v�= 6�p)&�(5�p)�p)hq)�q)xr)�t)w)�x)�y)�{)�|)�|)P})�})�~)�)��)��)8w)�{)HC 8k)�!��������HC 8k)H"��������HC 8k)�"�������� 6�p)��h]���������������p)��HC 8k) 6����H�) -`r)0t)`t)x)�~)��)ȅ)h]��������������Ȗˆ�q)�q)h]È�������������p)Lj�l������������������hq)�q)Xe��r)h]ӈ�������������p)׈xi׈���������r)X�l׈������������xr)�r)xi����������hs)H �p߈��������-�r)8s)xi�����������s)(2�`f���s)�h����hgψ�s)t) t)����`�������t)�w)h]��������������� �h]��������������p)�xi���������Pu)��l��������������t) u)�u)�u)xi ���������v)P �l�����������������hu)�u)xi'����������v)/X �p#���������- v)xv)h]'�������������Xw))�ha��w)8k)HC 8k)��)�^�������������w)�v)����Xe�����w)`4�����Px)�|)h]:����������������K�h]N��������������p)R�xiR����������x)��lR��������������x)�x)`y)�z)h]^��������������p)b�xib����������y)X�lb��������������y)�y)xil���������pz)` `oj���������'z)@z)�lS�����������������y)Py)xis���������P{)/h �po���������-�z) {)h]s�������������|)u�ha4��{)8k)HC 8k)���u�^��������������{)h{)����Xe����H|)h]���������������p)��h]���������������5��0})P})�})h]���������������p)��h]��������������Xw)ȉ�n����������5�})�l�������������������|) })^�����������|)�})����Xe��H~)h]ԉ�������������p)؉xi؉��������)X�l؉�������������~)�~)xi�����������)p �p����������-0)p)h]��������������Xw)���n����������5�)`o�����������)0�)h]���������������p)�xi����������)(2�^�����������)؀)����Xe�� �)�h����hgЉ`�)p�)��)����h]��������������p)��p)hq)�q)xr)�t)w)�x)�y)�{)�|)�|)P})�})�~)�)��)ȁ)�)��)��)x�)Ї)xi���������8�)X�l�������������ȁ)�)xi�����������)x �p���������0P�)��)h]#�������������|)4�`o ���������؃)�)h]<��������������p)@�xiD�����������)`^A������������)Ȅ)`�)����`oB���������&��)Ȅ)Xe<��)�h����hg �P�)��)��)����h]R�������������Xw)\�xik���������`�)`h]q��������������p)u�`oo���������&0�)x�)`fd���)�h����hgN���)��)�)����p�)`r)0t)`t)x)�~)��)ȅ)�)�)h]���������������p)��`f{�Ї)HC 8k)x5�����h]���������������� �)����ha����h�)8k)h]���������������� �)�����v����������^���������������)��)����Xe���� �)�t�������"x5�8k)q)�P��_��)�)(�)���j)��)����xi���������)��� �)���|p}@�)P��_��) �)@�)��)��)�)�|p}��)P��_�����������P��_���������H"��)�k�P�"0�):-���!��)v�= 60�)&�(50�)��)Ȑ)0�)ؑ) �)�)HC ��)�!��������HC ��)H"��������HC ��)�"�������� 6��)��h]��������������0�)��HC ��) 6������)��)��)x�)h]��������������ȖNJ�)0�)h]Ȋ������������0�)̊�l������������������Ȑ)�)Xe��h�)h]ڊ������������0�)ފxiފ��������@�)X�lފ������������ؑ)�)xi����������Ȓ)� �p����������0X�)��)h]��������������0�)��xi������������)��l�������������� �)X�)��)�)xi����������@�)� �l��������������������)��)xi�����������)/� �p���������-X�)��)`o������������)��)`fӊ8�)HC ��)������h]������������������)����ha����ؕ)��)h]������������������)�����v����������^�������������0�)h�)����Xe������)�t�������"����)x�)�P��_���)��)��)��P�)��)����xi��������)pv����)pv��|p}��)P��_�p�)��)�)!0�)�)��)X�)�|p}P�)P��_�)����������P��_���������Р)@��)Ƹ‰H"X�)�k�P�"��):-��p��h�)�̙�!�)v�= �~���)v]�i��)(�)��)�)H�)8�)p�)p�)`�)��)��)P�)��)`�)x�)��)��)`�)��)H�)HC �)�!��������HC �)H"����HC �)�"��������x�)P�)p�)��)��)8�)��)h]6�������������X�)?�xi?��������� �)X�l?���������������)��)xiK�����������)� �pG���������-8�)x�)xi[���������0�)(2�`fT��)�h����hg2���)H�)`�)����`d�������)h]h��������������~�n�h]h���������������)n�had�(�)�)HC �)�~�h��)X�)��|p}x�)P��_�8�)X�)x�)��)�|p}�)P��_�x�e��������P��_���������Щ)H�)8�)p�)p�)`�)��)��)P�)��)`�)x�)��)(�)`�)�)��)h]}�������������@�~�xi����������@�)� `y�������)Ц)h]���������������)��hay���)Р)HC �)@���h]�����������������)����^�������������H�)�)����Xe������)�ct������)X�)0�)��)h]���������������)��h]��������������X�)��xi����������ا)X�l��������������p�)��)�p����������/8�)��)h]���������������)��p�����������p�)����Xe����)`��������P�)ح)H�)��)Р)X�)��|p}x�)P��_�8�)X�)x�) ��)�|p}�)P��_���e��������P��_���������p�)`�)��)��)P�)��)`�)x�)��)(�)`�)�)��)`������ �)8�)h]��������������p����h]��������������X�)��h]���������������)��l��������������`�)��)h]��������������h�)��ha���)Щ)HC �)p����h]����������������h�)����^���������������)Ю)����Xe������)h]ŋ������������Ȗϋ��)��)h]Ћ������������h�)Ӌ�lŋ����������������P�)��)Xeŋ��)h]��������������h�)��xi����������ȱ)X�l��������������`�)��)xi����������P�)� �p����������0��) �)`����������)��)Щ)��)��|p}�)P��_�ص)��)�)��)�|p}��)P��_���_��������P��_���������x�)��)(�)`�)�)��)h]����������������)�h] ���������������,��p���������-x�)��)h]���������������)$�h]'�������������h�)*�^%���������(�)`�)����Xe���)h]C���������������)I�xiM���������h�)`h]S�������������h�)V�`oQ���������&8�)��)^J�����������)��)H�)����`oK���������&�)��)XeC���)hg����)��)��)�����h����hg܋h�)��)к)������)(�)��)�)H�)8�)p�)p�)`�)��)��)P�)��)`�)x�)��)(�)`�)�)��)�)P�)h�)X�)h]n���������������)t�h]y���������������,���pu���������-�)P�)xi������������)(2�`f��ȼ)�h����hgj���)�)(�)����h]����������������,��xi����������н)x5�l��������������h�)��)8�)X�)h]����������������)���l��������������������)(�)`f����)HC �)pv�����h]�����������������)����ha����H�)�)h]�����������������)�����v���������^���������������)ؿ)����Xe�����)�t������"pv��)h�)�P��_���)��)�)���)h�) ����xiÌ�����`�)h)���)h)��|p}�* P��_���)�)�[*�z�N* ��)(�*�|p}��)P��_�ތr� �������P��_����������~*�/���)潳�PE���)~���H"�)�k�P�"H�):-��(U�fA���!��)v�= H/���)v ���)��)�)H�)`�)��)p�)��)��)��)��)�)��)��)(�)�)�)H�)p�)�)�)�)�0h��X6�T�5�@H��v��)��.�{�(j�)����x���)8k)��)�)x�)h�*`�*��*�z+�+(�+HC x�)�!��������HC x�)H"��������HC x�)�"��������H/��)���/�H�)��h]ߌ��������������)��h]����������������)��HC x�)H/�����HC x�)�/������ *#X�)h�)��)��)��)0�)`�)h]��������������Ȗ����)��)h]����������������)���l������������������`�)��)Xe���)h]�������������Ȗ���)��)h]���������������)��l�����������������p�)��)Xe��)h]���������������)"�h]'���������������))��p#���������-��)��)xi8���������`�)�`f1�0�)�h����hg���)x�)��)����h]A���������������)E�h]H���������������,M�xiM���������p�)HTlM��������������)@�)��)��)h]V���������������)Z��lN�������������������)��)^F�����������)0�)����XeA���)h]a���������������)c�h]f���������������,k�xik�����������)HTlk�������������(�)`�)��)�)h]t���������������)v��ll�������������������)��)^d�����������)P�)����Xea���)h]����������������)��h]����������������)���p����������-�)H�)xi������������)�`f����)�h����hg~���)�) �)����`ɍ������)`�)h]͍������������PE�֍�)H�)`�)��)p�)��)��)��)��)�)��)��)(�)�)�)H�)8�)��)��)�)�)x�)h�)�)��)��) �)X�)��)p�)��)��)��)xiٍ�������� �)� h]ٍ��������������)ڍhaɍ8�)x�)HC x�)PE�ڍh]������������������)����^���������������)��)����Xe�����)x�)�)��|p}(�)P��_���)�)(�)��)�|p}��)P��_���U��������P��_���������p�)��)�)�)x�)h�)�c��������)��)��)h]����������������)��h]����������������)��xi����������x�)X�l���������������)H�)�p����������/��)��)h]���������������) �p�����������)����Xe�H�)`����������)��)��)��)��|p}�)P��_���)��)�)��)�|p}��)P��_� �U��������P��_���������x�)h�)h]���������������)�xi�����������)��l�������������x�)��)H�)h�)h])���������������)2��l�������������������)8�)xi8���������(�)/� �p4���������-��)��)�n4���������5@�)fI���)�h����hg���)��)��)����X�)h�)��)��)��)0�)`�)��)��)��)�)0�)��)��)*8*`Z�������)��)h]^�������������(U�e�h]h���������������)l�xil�����������)X�ll��������������)P�)h]m���������������)s�haZ���)x�)�z�h�)��� X�P*���7 ����ˈ: �/���)潳�(U���)fA���!��)v�= H/���)v �H"�)�k�P�"H�):-��k�8�)J��،�(*�(�A -PE���)~���h�(�)N��HC x�)(U�s�h]������������������)����^���������������)��)����Xe����0�)`y�������)��)h]}�������������h���h]����������������)��h]����������������)��`o����������' �)X�)h]��������������(�)��hay���)x�)HC x�)h���h]����������������(�)����^�������������p�)��)����Xe������)`ǎ����X�)�)h]ˎ������������k�ҎxiՎ����������)� h]Վ������������8�)֎haǎ��)x�)HC x�)k�֎h]����������������8�)����^���������������)��)����Xe������)x�)��)��|p}��)P��_���)��)��)P�)�|p}p�)P��_���G��������P��_����������)��)��)��) �)�)�c܎����P�)x�)8�)h]��������������8�)��h]����������������)��xi���������� �)X�l����������������)��)�p����������/��)8�)h]��������������8�)�p�������������)����Xe����)`����������)��)(�)��)��|p}��)P��_���)��)��)@�)�|p}`�)P��_��G��������P��_��������� �)�)h]���������������)�xi�����������)��l������������� �)X�)��)�)h]�������������8�)$��l�������������������)��)xi*�����������)/� �p&���������-H�)��)�n&���������5��)f;�0�)�h����hg �(�)X�)p�)�����)H�)`�)��)p�)��)��)��)��)�)��)��)(�)�)�)H�)8�)��)��)�)�)x�)h�)�)��)��) �)X�)��)p�)��)��)��)��)��) �)�)P�)�)��) �)X�)��)p*�*�*H*�*�*�*P*�*` -* *N*hR**P*�*0*h*�*�*0"* #*X#*�)*`L������)��)h]P��������������z�U�h]X���������������)Z�xiZ�����������)X�lZ�������������P�)��)h][�������������h�)a�haL��)x�)HC x�)�z�a�p�)�)�)�)H�)*0*�*� -*h]����������������h�)����^���������������)��)����Xe����0�)`g�������)�*h]k�������������،�p�h]t�������������h�)y�h]|�������������8�)��`oz���������' �)X�)h]��������������(*��hag���)x�)HC x�)،���h]����������������(*����^�������������p*��)����Xe�����*`ʏ����X* *h]Ώ������������X�ԏh]؏������������(�)ߏh]��������������(*���p����������/�*�*h]��������������(�)��h]��������������(*��r؏��������*H*�*h]��������������P*��haʏ�*x�)HC x�)X���h]����������������P*����^��������������*�*����Xe�����*`������*x *h]�����������������xi����������*� xi���������8*��� h]��������������*�ha�P*x�)���R*�~���hN*��<X�P*���7 �/���)潳�(U���)fA��@�� -*Ƹ‰ k�8�)J��h�(�)N������*�ˈ: H��@a*�GpB�!��)v�= H/���)v �،�(*�(�A -H"�)�k�P�"H�):-���z�h�)��� PE���)~���HC x�)����h]�����������������*����^��������������**����Xe����( *`������ *� *h] �������������@�!�xi$���������H -*� h]$�������������� -*%�ha�` -*x�)HC x�)@�%�h]����������������� -*����^������������� * -*����Xe����8 *��*X�)h�)��)��)��)0�)`�)��)��)��)�)0�)��)��)*8*� *�*`*h*x�*x�)H*��|p}h*P��_�(*H*�Y*C'�*�|p}*P��_�/�ʔ�������P��_���������(**P*�*0*h*�*�*0"* #*X#*�)*p**�**,*�1*�2*�c+�����`*�*H*h]2�������������� -*3�h]7�������������P*=��p4���������1*P*h]A�������������� -*B�pA�����������*����XeA�*`���������*`K*�K*�O*�X*� *�*��|p}�*P��_��*�*�T*C$P*�|p}p*P��_�D�ʔ�������P��_����������*0*h*�*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*h]P�������������� -*Q�h]V�������������P*\��pR���������-0*h*`��������(*J*0J*(*0*��|p}P*P��_�*0*�H*!�*�|p}�*P��_�^����������P��_����������5*�*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*�9*�:*h]l�������������(*q�h]t�������������P*z��pr���������0�*�*`���������*�3*�*�*��|p}�*P��_�� *� *� * -P!*�|p}p!*P��_�|�)��������P��_����������-*0"* #*X#*�)*p**�**,*�1*�2*�2*h]����������������)��xi�����������"*��l��������������0"*h"*#*�#*h]��������������8�)��h]��������������� -*��`o����������& #*X#*�l�������������������"*�"*xi����������X$*/� �p����������-�#*($*`���������$*,*(*'*��|p} '*P��_��'*(* (*�(*�|p}�(*P��_���t��������P��_����������)*p**�**h]N���������������)P�xiP����������)* SlP��������������)*�)*P**h+*h]W�������������8�)^�h]a�������������� -*b�`o_���������&p**�**xie���������P+*� `oc���������&�** +*�lQ�����������������**@**`fG��+*h]~�������������� -*�xi�����������,*� �p����������-,*P,*`�������� -*�3*(*(/*��|p}H/*P��_�0*(0*H0*�0*�|p}�0*P��_�����������P��_����������1*�2*�2*h]����������������)��xi����������2* Sl���������������1*�1*x2*3*h]�������������8�) �h]�������������� -*�`o���������&�2*�2*�l�����������������(2*h2*`f��H3*�h����hgz��,*�,*�3*����hg��p$*�$*�3*����h]3�������������(�):�h]=�������������P*C��p;���������0(4*`4*`�������� 5*�H*�*(7*��|p}H7*P��_�8*(8*H8*�8*�|p}�8*P��_�E�ۓ�������P��_���������XC*�9*�:*�:*�@*0A*�A*`G*h]U���������������)Y�xiY���������:*��lY��������������9*�9*x:*;*h]e���������������)n�h]q�������������� -*r�`oo���������&�:*�:*�lZ�����������������(:*h:*xix����������;*/ �pt���������-H;*�;*`��������p<*�A*�5*x>*��|p}�>*P��_�X?*x?*�?*@*�|p}8@*P��_���2��������P��_����������@*0A*h]��������������*!�h]$�������������� -*%�^"����������@*0A*����Xe�hA*h]<�������������� -*=�xiB���������8B* �p>���������-�A*B*`���������B*0H*�5*�D*��|p}E*P��_��E*�E*F*�F*�|p}�F*P��_�E�ѓ�������P��_���������`G*h]���������������*��xiÓ���������G* ^����������`G*�G*����Xe���G*�h����hg8�PB*�B*HH*����hgQ��;*(<*XH*�����*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*�9*�:*�:*�@*0A*�A*`G*�h����hg/��4*�4*�I*����hgh� *`*�I*����f���*0*h*�*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*�9*�:*�:*�@*0A*�A*`G*L*M*@M*HO*pP*`Q*�Q*S*�S*�S*�h����hgL��*�*PK*����`�������K*�O*h]�����������������h]���������������) �xi ����������L*��l �������������L*PL*�L*xM*h]���������������)!�h]$�������������� -*%�`o"���������&M*@M*�l ������������������L*�L*h]%�������������hN*&�ha��N*(*HC x�)�� &�(�*p�)�)�)�)H�)*0*�*� -*HN*�R* a*h]����������������hN*����^�������������HO*�M*����Xe�����O*`.�����0P*�S*h]2���������������8�h];���������������)=�xi=����������P*��l=�������������pP*�P*@Q*�Q*h]I�������������8�)P�h]S�������������� -*T�`oQ���������&`Q*�Q*�l>������������������P*0Q*h]T��������������R*U�ha.�hR*(*HC x�)�� -U�h]�����������������R*����^�������������S*R*����Xe����@S*h]a�������������hN*i�h]n��������������R*t��pj���������-�S*�S*�nj���������5T*f~��*h]��������������hN*��0*h*�*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*�9*�:*�:*�@*0A*�A*`G*L*M*@M*HO*pP*`Q*�Q*S*�S*�S*�T*xW*�W*xi���������� W*/ �p����������-�T*�V*h]���������������*��h]”������������� -*Ô^����������xW*�W*����Xe���W*�h����hg��8W*8X*PX*����hg]�XT*�T*`X*����*P*�*0*h*�*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*�9*�:*�:*�@*0A*�A*`G*L*M*@M*HO*pP*`Q*�Q**P*�*0*h*�*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*�9*�:*�:*�@*0A*�A*`G*L*M*@M*HO*pP*`Q*�Q*S*�S*�S*�T*xW*�W*�)H�)`�)��)p�)��)��)��)��)�)��)��)(�)�)�)H�)8�)��)��)�)�)x�)h�)�)��)��) �)X�)��)p�)��)��)��)��)��) �)�)P�)�)��) �)X�)��)p*�*�*H*�*�*�*P*�*` -* *N*hR**P*�*0*h*�*�*0"* #*X#*�)*p**�**,*�1*�2*�2*(4*`4*�9*�:*�:*�@*0A*�A*`G*L*M*@M*HO*pP*`Q*�Q*S*�S*�S*�T*xW*�W*�`*�a*8f*pf*�f*`h*�h*i*xn*�n*(o*p*@v*�w*�x*Hz*�{*�{*�|*�|*��* �*�*��*�*��*Ї*`Д����``*b*h]Ԕ������������H��הxiڔ���������`*�h]ڔ������������@a*ܔhaД�`*x�)HC x�)H�� ܔh]����������������@a*����^��������������a*�`*����Xe�����a*x�)�c*��|p}�c*P��_��d*�d*�d* Xe*�|p}xe*P��_�D�!��������P��_���������pj*8f*pf*�f*`h*�h*i*xn*�n*(o*p*@v*�w*�x*h]E�������������� -*F�h]I���������������)R�h]U��������������*b�`oS���������&pf*�f*xie���������Pg* `oc���������&�f* g*^G���������8f*hg*����XeE��g*�c@������i*�g*�h*�i*h]h�������������� -*i�h]m���������������)t��pj���������1`h*�h*h]x�������������� -*y�px����������i*����Xex�Hi*`���������i*z*0b*�k*��|p}l*P��_��l*�l*m*�m*�|p}�m*P��_�{�!��������P��_���������8r*xn*�n*(o*p*@v*�w*�x*h]��������������� -*��h]����������������)���p����������-xn*�n*h]����������������)��xi�����������o*��l��������������(o*`o*�o*p*h]��������������� -*���l�������������������o*�o*xi�����������p*/( �p����������-Pp*�p*`o�����������n*�p*`���������q*�y*pj*�s*��|p}�s*P��_��t*�t*�t*`u*�|p}�u*P��_�����������P��_���������@v*�w*�x*h]ƕ������������@a*ɕxiɕ���������v*X�lɕ������������@v*xv*xiՕ��������0w*0 �pѕ��������-�v*w*h]��������������@a*��xi�����������w*a^������������w*�w*Xx*����`o����������&�w*�w*Xe��x*h]�������������@a* �xi ���������y*^ -�����������x*�x*�y*����`o ���������&�x*�x*Xe�0y*hg•Hw*�x*�y*�����h����hg��0q*pq*z*����h]��������������@a*��xi�����������z*X�l��������������Hz*�z*xi����������8{*8 �p����������0�z*{*h]��������������@a*��h]����������������)��xi����������0|* Sl���������������{*|*�|*(}*h]Ö������������8�)ʖh]͖�������������*ږ`o˖��������&�|*�|*�l������������������H|*�|*`o����������&�{*h}*`f���}*`��������`~*��*��*`�*x�)h�*��|p}��*P��_�H�*h�*��*�*�|p}(�*P��_���n��������P��_�����������* �*�*��*�*��*Ї*h]��������������8�)��h]���������������*�^�������������* �*��*����`o����������&��* �*Xe��X�*h]���������������)�xi���������h�*��l��������������*8�*Є*��*h] �������������8�)'��l�������������������*��*xi-�����������*/@ �p)���������-(�*��*h]@�������������8�)G�p@�����������*����Xe>�@�*�h����hg�ȅ*��*��*����h]V���������������)X�xiX���������H�* SlX���������������*�*��*Ї*h]_�������������8�)f��lY�����������������`�*��*`fO��*hg��P{*~*~*����HC x�)h)� ����h]������������������*����ha������*x�)h]������������������*�����v͌��������^�������������H�*��*����Xe������*�t͌�����"h)�x�)�)�P��_���*��*��*͌0�)�*"�����j)(�)��)�)��*��*(�* z+��+xix������P�*X.����*X.��|p}�*P��_�Ѝ*��*�*��*p�*h�*�|p}��*P��_������������P��_���������H"��*�k�P�"�*:-���!p�*v�= 6�*&�(5�*Ȑ*��*h�*HC h�*�!��������HC h�*H"��������HC h�*�"�������� 6Ȑ*��h]���������������*��HC h�* 6����X�*8�*Б*h]���������������*��`f����*HC h�*X.�����h]������������������*����ha����0�*h�*h]������������������*�����v����������^���������������*��*����Xe������*�t������"X.�h�*H�*�P��_���*��*��*�� �*P�*$����xi������H�*�z����*�z��|p}�* P��_�Ȗ*��*8�*!!��* h�*��*�|p}��*P��_�їD��������P��_���������x�*���z��dH"��*�k�P�"��*:-�� ���**��8�*��*��I�!h�*v�= 6��*&�(5��*��*��*��*��*�*��*@�*��*`�*�*��*ئ*0�*Ш*P�*��*؟*��*��*h�*HC `�*�!��������HC `�*H"��������HC `�*�"�������� 6��*֗h]җ��������������*֗HC `�* 6������* ��*X�*��*��*��*x�*ذ*h]ޗ������������Ȗ��ؚ*��*h]����������������*���lޗ������������������*Ț*Xeޗ0�*h]����������������*��xi�����������*X�l����������������*؛*xi�����������*H �p���������- �*`�*xi����������*(2�`f���*�h����hg����*0�*H�*����`!�����Н*Ƞ*h]%������������� �)�h],���������������*0�xi0���������x�*��l0��������������*H�*��*�*xi<���������0�*P �l1�������������������*О*h]=���������������*>�ha!���*`�*HC `�* �>�h]������������������*����^�������������@�*H�*����Xe����x�*`D�����(�*��*hasRoot]�0�*��Ih]H�������������8�*O�h]S���������������*W�xi\����������*/X �pX���������-��*ء*h]c���������������*d�haD�`�*`�*HC `�*8�*d�h]������������������*����^��������������* �*����Xe����8�*`j�������*`�*h]n����������������q�xiu���������X�*` xit�����������*��h h]u���������������*v�haj���*`�*8�*��*��I�!h�*v�= 6��*&�(5@���*Ƹ‰�����*z��dH"��*�k�P�"��*:-�� ���**��Ќ���*���nHC `�*���v�h]������������������*����^�������������ئ*p�*����Xe�����*`|�������*X�*h]��������������Ќ���xi������������h]����������������*��ha|�0�*`�*HC `�*Ќ���h]������������������*����^�������������Ш*�*����Xe�����*`�*�*��|p} �*P��_���*�* �* ��*�|p}��*P��_������������P��_���������H�*��*8�*(�*��*P�*��*x�*p�*�*8�*p�*8�*h]��������������@���h]����������������*��xi���������� �*X�l����������������*��*xi������������*p `o����������'8�*x�*`������H�*��*h]����������������*��ha��P�*x�*HC `�*@�����*؟*��*��*h�*��*h]������������������*����^�������������8�*��*����Xe����p�*�c��������*�*��*h�*h]����������������*��xi������������*x �p����������2(�*`�*h]����������������*˜p�������������*����Xe�� �*`��������Ȳ*X�*�*x�*д*��|p}��*P��_���*е*��*p�*�|p}��*P��_�Ę���������P��_���������0�*P�*��*x�*p�*�*8�*p�*8�*h]̘��������������*Иh]Ә��������������*טxiט����������*��lט��������������*��*X�*x�*h]����������������*���lؘ�����������������*H�*^ј��������P�*��*����Xe̘�*h]����������������*��xi����������ع*/� �p����������-p�*��*`��������x�*8�*H�*��*��|p}��*P��_�`�*��*��* �*�|p}@�*P��_��W��������P��_���������0�*�*8�*p�*h]���������������*��n���������5�*`����������*��*�*��*��*��|p}��*P��_���*��*��*X�*�|p}x�*P��_� �O��������P��_���������8�*p�*h],���������������*/�h]2���������������*3�^0���������8�*p�*����Xe,���*f?�ذ*�h����hg �8�*h�*(�*����`����������*��*H�*��*��|p}��*P��_���*��*��*X�*�|p}x�*P��_�]����������P��_���������8�*h]����������������*��xi����������P`^����������8�*p�*����Xe����*hg����*0�*h�*������*��*��*��*�*��*@�*��*`�*�*��*ئ*0�*Ш*P�*��*8�*(�*��*P�*��*x�*p�*�*8�*p�*8�*@�*H�*0�*h�*@�*x�*h]Ù��������������*ƙxi̙����������*� xi˙����������*��� �pǙ��������-@�*��*h]ܙ��������������*��xi������������*`xi������������*(2�rܙ��������H�*��*��*`fՙ�*�h����hg���*P�*h�*����p�*��*X�*��*��*��*x�*ذ*x�*�*�*h]����������������*�h]���������������*�xi �����������*� �p���������-h�*��*`o���������0�*��*//] �h�*��sxi�����������*p�*`f���*�h����hg��(�*��*�*����h]-���������������*1�xi1�����������* Sl1�������������@�*x�*�*0�*x�*xi8���������`�*� h];���������������*>��l2�������������������*�*`f&���*HC `�*�z�����h]���������������� �*����ha����h�*`�*h]���������������� �*�����v����������^���������������*��*����Xe���� �*�t������"�z�`�*@�*�P��_��*�*(�*���*��*&����xiJ� ������*�i�� �*�i��|p}��* P��_��* �*�I+C<0�* ��*�x+�|p}��*P��_�e�ԣ�������P��_����������+�L+A��*v:�H"��*�k�P�"0�*:-��H�P�*�S_���z��d�!��*v�= 6h�*&�(5h�*��*��*0�*H�*��*(�*��*�*��*��*��*P�*p�*��*h�*��*0�*0�*��*�*��*HC ��*�!��������HC ��*H"��������HC ��*�"�������� 6��*j�A0�*o�h]f�������������h�*j�h]l���������������*o�HC ��* 6����HC ��*A�����*hy+��*�*(�*8�*�*�*�w+h]{���������������*~�h]����������������,���p���������-H�*��*�n���������5��*h]����������������*���n����������8(�*xi������������*`7�p����������-`�*��*�n����������5��*`o������������*�*h]��������������x�,š��*��*xiÚ�������� �*�s�hm������������*��*�����s����������8�*Xe����*�h����hgw�H�*��*��*����h]��������������Ȗ��`�*��*h]��������������h�*���l�������������������*P�*Xe����*`�����p�* �*h]�������������H� �xi�����������*� h]�������������P�*�ha���*��*HC ��*H��h]����������������P�*����^���������������*��*����Xe������*`�������*��*h]�����������������xi �����������*� xi���������8�*��� h] �������������(�*!�ha�P�*��*P����**&{� -A��*v:��!��*v�= 6h�*&�(5@���*Ƹ‰H"��*�k�P�"0�*:-��H�P�*�S_���(�*z��dЌ� �*���n�����*F��� HC ��*���!�h]����������������(�*����^�������������p�*�*����Xe������*`'�����X�*��*h]+�������������Ќ�7�xi:�����������h]:������������� �*>�ha'���*��*HC ��*Ќ�>�h]���������������� �*����^�������������h�*��*����Xe������*`D�����P�*h]H�������������@�I�h]H���������������*I�haD���*��*HC ��*@�H�h]T���������������*W�h]\���������������,e���*0�*H�*��*(�*��*�*��*��*��*P�*p�*��*h�*��*0�*h�*�*��*`�*��*0�*p�*0�*0�*h�*H�*x�*��*�+�+�+x+�pX���������-0�*h�*�nX���������5��*h]i���������������*l�xil�����������*X�ll��������������*P�*xiv����������*� �pt���������0��*��*`of�����������* �*h]{���������������*~�xi~����������*X�l~���������������*��*h]��������������h�*��xi������������*X�l��������������`�*��*�p����������1 �*��*`ox���������`�* �*`����������*��*��*�*h+�G+�I+��*��*��|p}�*P��_���*��*`E+!��*�|p}��*P��_���`��������P��_����������+p�*0�*0�*h�*H�*x�*��*�+�+�+x+�B+�B+HC+�C+ D+h]����������������*��xi������������*X�l��������������p�*��*h]��������������h�*��xi������������*X�l��������������0�*h�*�p����������-��*��*h]����������������*Ûh]ț������������h�*̛�pě��������-0�*h�*`o������������*��*xiݛ��������P�*�`f֛ �*�h����hg����*h�*��*����`�������*�*h]�������������������h]����������������*��xi������������*X�l��������������H�*��*xi���������8�*� `o����������'��*�*h]���������������*�ha����*h�*HC ��*�����x+0�*��*�*��*��*h�*h]������������������*����^�������������x�*P�*����Xe������*` -�����`�*X�*h]�������������P���xi"�����������*� xi!����������*��� h]"���������������*#�ha -�0�*h�*HC ��*P��#�h]������������������*����^���������������*��*����Xe�����*h�*�*��|p} �*P��_���*+ +�+�|p}�+P��_�/�Š�������P��_����������+�+�+�+x+h]0���������������*1�h]4�������������h�*8�xi8��������� +X�l8��������������+�+xiB����������+� `o@���������'8+x+^2����������+�+����Xe0�+�c+�����+P+8+�+h]E���������������*F�xiJ��������� +� �pG���������2�+�+h]O���������������*P�pO����������x+����XeO��+`��������X+�+� +hB+��*`+��|p}�+P��_�@+`+`A+! +�|p} +P��_�R�Š�������P��_���������8+ �@ +*��h -+X +� +� +�+�+�+@+$+�$+ %+�&+,+P,+@-+�2+ +`\�����( -+� +h]b������������� �f�h]i�������������h�*m�xim���������� -+��lm�������������h -+� -+8 +X +h]y���������������*z��ln������������������ -+( +h]z�������������@ +{�ha\�� +�+HC �+ �{�^�������������� +� +����Xe����� +h]��������������@ +��xi����������X +/� �p����������-� +( +`��������� +@+�++��|p} +P��_��++ +�+�|p}�+P��_������������P��_����������+�+�+�+h]6������������� �*B��n5���������5�+`��������0+++x+8+��|p}X+P��_�+8+X+�+�|p}�+P��_�D���������P��_����������+�+h]R�������������P�*W�h]Z���������������*[�xi^���������X+� `o\���������&�+(+^X����������+p+����XeR��+fm�h+�h����hg1��+�+0+����`���������+X&+0A+�+�+��|p}�+P��_��+�+�+`+�|p}�+P��_������������P��_���������(+@+$+�$+ %+�&+,+P,+@-+�2+9+89+�>+@+P@+h]����������������*��xi�����������+ xi�����������+�� �p����������-@+�+`���������+�$+0&+8+�!+��|p}�!+P��_�x"+�"+�"+8#+�|p}X#+P��_������������P��_���������$+�$+ %+h]V������������� �*b�xie���������P`^c���������$+P$+����XeV��$+h]x���������������*��h]����������������*��xi�����������%+ `o����������& %+X%+^�����������$+�%+����Xex��%+�h����hg��+H+H&+����h]����������������*��xi�����������&+ �p����������2�&+�&+`���������'+�@+8+�)+��|p}�)+P��_�x*+�*+�*+ 8++�|p}X++P��_������������P��_����������:+,+P,+@-+�2+9+89+�>+@+P@+h]��������������@ +�h]���������������* -�xi -����������,+��l -�������������P,+�,+ -+@-+h]���������������*��l ������������������,+-+�p���������-,+x-+`��������X.+�9+(+`0+��|p}�0+P��_�@1+`1+�1+2+�|p} 2+P��_�����������P��_����������4+�2+9+89+h]5���������������*;�p5�����������2+����xiA����������3+ xi@����������3+��( �p<���������-3+�3+`��������x4+�9+�.+�6+��|p}�6+P��_�`7+�7+�7+ 8+�|p}@8+P��_�D�ܟ�������P��_���������9+89+h]ğ������������(�*ǟh]ʟ��������������*˟^ȟ��������9+89+����Xeğp9+�h����hg/��3+04+�9+����`��������`:+@+�@+(+h<+��|p}�<+P��_�H=+h=+�=+>+�|p}(>+P��_������������P��_����������>+@+P@+h]g���������������*m�xiq���������P?+0 xip����������?+��8 ^n����������>+h?+����Xeg��?+h]��������������(�*��h]����������������*��^����������@+P@+����Xe���@+hg���-+.+:+�����h����hg��'+H'+ A+����h -+X +� +� +�+�+�+@+$+�$+ %+�&+,+P,+@-+�2+9+89+�>+@+P@+hg��p +� +p+����h]Ѡ������������P�*֠h]۠������������(�*ޠ�pנ��������-�B+�B+h]��������������(�*��h]����������������*��^����������HC+�C+����Xe���C+h]�������������(�*�xi����������D+@ xi����������D+��H �p���������- D+�D+h]#�������������(�*&�p�*0�*0�*h�*H�*x�*��*�+�+�+x+�B+�B+HC+�C+ D+(E+hF+H+�H+(I+h])�������������h�*-�xi-����������F+X�l-�������������hF+�F+^'���������(E+�F+����Xe#�(G+�h����hg ��D+xG+�G+����hg͠C+D+�G+����h]C�������������h�*G�xiG���������hH+ SlG�������������H+8H+�H+�H+(I+h]N�������������P�*S�h]U�������������(�*X��lH������������������H+�H+`f<�`I+��*0�*H�*��*(�*��*�*��*��*��*P�*p�*��*h�*��*0�*h�*�*��*`�*��*0�*p�*0�*0�*h�*H�*x�*��*�+�+�+x+�B+�B+HC+�C+ D+(E+hF+H+�H+(I+�T+U+W+�W+(]+^+d+8i+pi+�j+�p+�q+�q+hs+u+v+8v+`��������0L+�V+�t+�w+��*8N+��|p}XN+P��_�O+8O+pv+!�O+�|p}�O+P��_�f�У�������P��_����������P+�T+U+W+�W+(]+^+d+8i+pi+�j+�p+�q+�q+hs+u+v+�L+HR+��|p}hR+P��_�(S+HS+hS+ �S+�|p}T+P��_�r�{��������P��_��������� Y+�T+U+W+�W+(]+^+d+8i+pi+�j+�p+�q+�q+h]s���������������*t�h]w�������������h�*{�xi{���������hU+X�l{�������������U+8U+xi�����������U+P `o����������'�U+�U+^u����������T+V+����Xes�HV+�cn�����XX+�V+�W+@X+h]����������������*��xi����������hW+X �p����������2W+8W+h]����������������*��p������������W+����Xe���W+`���������X+8s+�P+�Z+��|p}�Z+P��_��[+�[+�[+ H\+�|p}h\+P��_���{��������P��_����������l+(]+^+d+8i+pi+�j+�p+�q+�q+h]��������������h�*��xi�����������]+��l��������������(]+`]+�]+^+h]����������������*���l�������������������]+�]+xi�����������^+/` �p����������-P^+�^+`��������x_+�j+ Y+�a+��|p}�a+P��_�`b+�b+�b+ c+�|p}@c+P��_�á���������P��_���������0e+d+8i+pi+h]^������������� �*j��n]���������5d+`���������d+�j+�j+�_+�f+��|p}�f+P��_��g+�g+�g+Xh+�|p}xh+P��_�l����������P��_���������8i+pi+h]z�������������P�*�h]����������������*��xi�����������i+h `o����������&pi+�i+^����������8i+�i+����Xez�0j+f���V+�h����hgY�8d+hd+�j+����h]��������������(�*��xiĢ��������Xk+p xiâ���������k+��x �p����������-�j+pk+`��������@l+�q+�r+ Y+Hn+��|p}hn+P��_�(o+Ho+ho+�o+�|p}p+P��_�Ǣs��������P��_����������p+�q+�q+h]=������������� �*I�xiL���������P`^J����������p+q+����Xe=�0q+h]]�������������(�*`�h]c���������������*d�xig���������8r+� `oe���������&�q+r+^a����������q+Pr+����Xe]��r+�h����hg���k+�k+�r+����hg���^+0_+s+����h]��������������(�*��xi�����������s+� xi����������t+��� �p����������-hs+�s+xi�����������t+�`f��pt+�h����hg��0t+�t+�t+����h]��������������h�*��xi����������xu+ Sl��������������u+Hu+�u+v+8v+h]��������������P�*ãh]ţ������������(�*ȣ�T+U+W+�W+(]+^+d+8i+pi+�j+�p+�q+�q+hs+u+v+8v+�l�������������������u+�u+`f��xw+hgP�`�*��*�K+����HC ��*�i�����h]����������������x+����ha����`x+��*h]����������������x+�����vT���������^��������������x+�x+����Xe����y+�tT� ����"�i���*��*�P��_�z+z+ z+T�P�*�y+(����xiڣ����xz+�(��|+�(��|p}��+ -P��_��|+}+��+!x�+ �~+ �+�|p}�}+P��_���N��������P��_�����������+��+�0�@�+V�W!H"�~+�k�P�"(+:-��83�P�+bF:,���z��d�!�~+v�= 6(�+&�(5(�+�+��+(�+��+��+��+��+P�+p�+Ȋ+h�+،+��+@�+��+��+ �+0�+��+�+HC �z+�!��������HC �z+H"��������HC �z+�"�������� 6�+��h]��������������(�+��HC �z+ 6����H�+ -��+Ё+(�+8�+�+�+��+h]�������������Ȗ -��+(�+h] �������������(�+��l�������������������+��+Xe�`�+`������+�+h]��������������0�"�xi&�����������+� xi%���������Ђ+��� h]&�������������@�+'�ha���+�z+HC �z+�0�'�h]����������������@�+����^���������������+��+����Xe������+`-�����p�+ �+h]1�������������83�:�xi=�����������+� h]=�������������P�+>�ha-���+�z+HC �z+83�>�h]����������������P�+����^���������������+��+����Xe����Ѕ+`D�������+��+h]H����������������K�xiO�����������+� xiN���������8�+��� h]O�������������(�+P�haD�P�+�z+83�P�+bF:,�0�@�+V�W!�!�~+v�= 6(�+&�(5@���+Ƹ‰ H"�~+�k�P�"(+:-�����(�+z��dЌ� �+���nX;�0�+�Z�FHC �z+���P�h]����������������(�+����^�������������p�+�+����Xe������+`V�����X�+��+h]Z�������������Ќ�f�xii�����������h]i������������� �+m�haV�Ȋ+�z+HC �z+Ќ�m�h]���������������� �+����^�������������h�+��+����Xe������+`������P�+H�+h]��������������X;���xi������������+� h]��������������0�+��ha��،+�z+HC �z+X;��� �+ �+0�+��+�+�+x�+h]����������������0�+����^���������������+��+����Xe������+�z+��+��|p}�+P��_�А+��+�+��+�|p}��+P��_��Ө�������P��_�����������+��+��+Е+��+h] �������������@� �h]�������������(�+�xi����������+X�l���������������+��+xi�����������+� `o���������'(�+h�+`�����8�+h�+h]���������������+�ha�@�+h�+HC �z+@��h]������������������+����^���������������+��+����Xe�����+�c�����(�+��+P�+�+h] ���������������+!�xi%���������8�+� �p"���������2Е+�+h]*���������������++�p*������������+����Xe*�Ȗ+`��������p�+��+��+��+��+`�+�z+x�+��|p}��+P��_�X�+x�+��+!�+�|p}8�+P��_�-�Ө�������P��_�����������+ �X�+*����+p�+�+�+��+Щ+�+��+��+��+��+(�+��+��+��+��+8�+`5�����@�+��+h];������������� �?�h]B�������������(�+F�xiF�����������+��lF���������������+��+P�+p�+h]R���������������+S��lG������������������+@�+h]S�������������X�+T�ha5��+��+HC ��+ �T�^��������������+��+����Xe������+h]`�������������X�+d�xii���������p�+/� �pe���������-�+@�+`���������+X�+��+��+�+��|p}8�+P��_���+�+8�+��+�|p}أ+P��_�r�h��������P��_���������ȥ+��+Щ+�+h]������������� �+��n���������5��+`��������H�+�+0�+��+P�+��|p}p�+P��_�0�+P�+p�+��+�|p}�+P��_��N��������P��_���������Щ+�+h]!�������������P�+*�h]-���������������+.�xi1���������p�+� `o/���������&�+@�+^+���������Щ+��+����Xe!�Ȫ+f>���+�h����hg�Ф+�+H�+�����eW���+�h����hg\���+ȟ+��+����h]s�������������(�+v�xi|���������H�+� xi{�����������+��� �pw���������-��+`�+`��������0�+p�+г+��+8�+��|p}X�+P��_��+8�+X�+ذ+�|p}��+P��_����������P��_�����������+��+��+h]�������������� �+��xi����������P`^������������+��+����Xe�� �+h]�������������(�+ �h]���������������+�xi���������(�+� `o���������&��+��+^ �����������+@�+����Xe���+�h����hgo���+��+��+����h]'�������������X�++�xi0�����������+.�p,���������-(�+`�+`��������0�+��+��+8�+��|p}X�+P��_��+8�+X�+ظ+�|p}��+P��_�9���������P��_�����������+��+��+��+��+h]��������������@�+��xi���������� �+xi����������h�+���p����������-��+8�+h]��������������@�+��h]����������������+��^������������+��+����Xe��0�+h]̧������������0�+קxiܧ���������+�pا��������-��+л+�nا��������5�+h]��������������0�+��xi������������+ ^������������+��+����Xe���+�h����hgȧX�+X�+p�+����hg����+��+��+������+p�+�+�+��+Щ+�+��+��+��+��+(�+��+��+��+��+��+��+��+h] �������������@�+�xi���������P�+(xi�����������+��0�p���������-��+h�+�n���������5��+`��������h�+�+��+p�+��|p}��+P��_�P�+p�+��+�+�|p}0�+P��_��ͨ�������P��_�����������+h]��������������0�+��xiè��������X�+8xi¨����������+��@^������������+p�+����Xe����+�h����hg���+ �+ �+����hg#���+��+0�+�����+��+(�+��+��+��+��+P�+p�+Ȋ+h�+،+��+@�+��+��+Е+��+��+��+��+��+��+��+ �+X�+��+��+��+h]ݨ������������@�+��xi�����������+Hxi����������H�+��P�p����������-��+�+h]��������������(�+��xi����������+Xxi���������P�+��`�p����������-��+ �+`o����������`�+h�+h]O�������������0�+Z�xi_���������P�+h�p[���������-��+ �+`o�����������+h�+h]��������������0�+��xi����������P�+p�p����������-��+ �+h]Ω������������@�+֩h]۩������������(�+ީxi����������H�+x`oߩ��������'��+�+�pש��������-��+`�+`o©��������h�+��+h]��������������@�+��h]��������������P�+�xi�����������+�`o���������&X�+��+�p����������- �+��+`o������������+�+`oa�����������+X�+`�������� �+��+�z+(�+��|p}H�+P��_��+(�+H�+��+�|p}��+P��_� �$��������P��_���������xi�����������+�`f���+�h����hg٨��+��+�+������+��+Ё+(�+8�+�+�+��+�+��+h]0�������������(�+4�xi4���������8�+ Sl4���������������+�+��+��+��+h];�������������@�+C�h]E�������������(�+H��l5�����������������P�+��+`f)�0�+HC �z+�(�����h]������������������+����ha������+�z+h]������������������+�����v����������^�������������@�+x�+����Xe������+�t������"�(��z+p�+�P��_���+��+��+��Hz+�+*����xiT������+�����+���|p}��+P��_���+��+��+@�+ �+��+�|p}`�+P��_�k�Z��������P��_����������+H"h�+�k�P�"��+:-���! �+v�= 8<��+�����+x�+H�+��+ �+�+��+p�+��+HC �+�!��������HC �+H"��������HC �+�"��������8<x�+v�h]l���������������+v�HC �+8<�����+h�+��+�+h]����������������+��xi�������������p����������-H�+��+h]����������������+���n����������8��+xi������������+����p����������-(�+X�+�n����������5��+`o������������+��+`����������+h�+�+��+��|p}��+P��_���+��+��+@�+�|p}`�+P��_���1��������P��_��������� �+�+h]˪������������x�,Ԫh�+��+��+�+@�+ު��+x�+��+��+H�+xiު����������+h��xiު����������+h��h]���������������+ ��n���������8�+xi �����������+�xi �����������+��+H�+n������������+`oު��������&��+ �+`o���������&`�+x�+hmǪ�������� �+X�+�����s������������+Xe��8�+�h����hg~��+P�+��+����h]=��������������RD��+(�+p�+xiE���������X�+`h]J���������������+T��l=�������������������+��+`f6���+HC �+������h]�����������������+����ha����`�+�+h]�����������������+�����v\���������^���������������+��+����Xe�����+�t\�����"���+��+�P��_��+�+ �+\���+��+,�����j)(�)��)�)��*��*(�* z+��+ �+��,��,��,@�,��,xi`������+�����+���|p}� , P��_���+��+pz,�dH&, 0�+p�,�|p}p�+P��_�u�`� - �������P��_���������p,����+�������n�H"x�+�k�P�"��+:-�� ��,*���!0�+v�= 6��+&�(5��+��+X�+��+P�+��+��+��+��+�, ,H,,(,P,�,� ,��+�,@,�,HC (�+�!��������HC (�+H"��������HC (�+�"�������� 6��+z�h]v���������������+z�HC (�+ 6����ؤ,#P�+h�+8�+h�+�,�,,h]��������������Ȗ����+��+h]����������������+���l������������������X�+��+Xe����+`��������+x�+h]��������������������+ ��+h�+ �+��+xi����������P�+�>xi������������+� �+h�+��������xi�����������+�=xi����������P�+���+ �+��������xi������������+p?xi�����������+���+��+��������xi«��������x�+Axiǫ����������+�H�+��+��������xi˫��������0�+h@xiѫ��������x�+��+H�+����������+h�+ �+��+��+ j������������+����h]ԫ��������������+իha��P�+(�+HC (�+��իh]������������������+����^���������������+�+����Xe����(�+h]߫��������������+��xi������������+X�l����������������+��+xi������������+��p����������-�+P�+h]����������������+�`f����+�h����hg۫��+�+(�+����`�������+�,h] ������������� ��h]���������������+�xi���������X�+��l���������������+(�+��+��+xi#���������,��l�����������������p�+��+h]$��������������,%�ha��,(�+HC (�+ �%�h]�����������������,����^������������� ,(,����Xe����X,`+�����,�,h]/���������������9�h]=��������������,A�xiF����������,/��pB���������-H,�,h]M��������������,N�ha+�,(�+Ќ��,���n @�Ƹ‰ 83��,bF:, ����+�������,�n��!0�+v�= 6��+&�(5H"x�+�k�P�"��+:-�� ��,*��H��,�S_�0��,V�W!����,z��d -HC (�+��N�h]�����������������,����^�������������(,�,����Xe����`,`T�����,h]X�������������H�]�h]X��������������,]�haT�P,(�+HC (�+H�X�h]g��������������,q�`��������p,P ,8,(�+x ,��|p}� ,P��_�X -,x -,� -, ,�|p}8 ,P��_�s����������P��_���������� ,h ,h]{���������������+~�xi~���������` ,�>l~�������������� ,0 ,xi����������� ,`^����������x ,� ,����Xe{� ,h]���������������,��xi����������� ,�^����������h ,� ,����Xe��� ,��+X�+��+P�+��+��+��+��+�, ,H,,(,P,�,� ,h ,(,X,@,8,�,�,0,�,(,P,� ,8$,�%,�&,�+,,,`���������,�,(�+�,��|p}�,P��_��,�,�,H,�|p}h,P��_������������P��_���������(,h]���������������,��xi�����������,�^����������(,`,����Xe���,hgc��,(,X,����`Ĭ�����,�,h]Ȭ�������������0�ЬxiԬ���������,�xiӬ��������@,���h]Ԭ�������������,լhaĬX,(�+HC (�+�0�լ��+�,@,�,�,p,�,�,� ,h]�����������������,����^�������������@,,����Xe����x,P�+h�+8�+h�+�,�,,@,h,x,�,�,�$,�+,�,X�,`۬�����,`,h]߬������������83���xi���������� ,�h]���������������,��ha۬8,(�+HC (�+83���h]�����������������,����^��������������,�,����Xe����,`�������,�,h]�������������������xi����������0,�xi����������x,���h]���������������,��ha���,(�+HC (�+�����h]�����������������,����^�������������0,H,����Xe����h,`�����,�,h]�������������Ќ��xi�����������h]��������������,�ha��,(�+HC (�+Ќ��h]�����������������,����^�������������(,X,����Xe����`,`!�����,�$,h]%�������������@�&�h])���������������+-�xi-����������,X�l-�������������P,�,xi7���������@ ,�`o5���������'�, ,h]7��������������#,8�ha!�� ,(�+83��,bF:, @��#,Ƹ‰ 6��+&�(5 ��,*��Ќ��,���n ����+�������,�n��!0�+v�= �0��,V�W!H"x�+�k�P�"��+:-��H��,�S_����,z��d -X;�&,�Z�F HC (�+@�8�h]�����������������#,����^�������������8$,X ,����Xe����p$,`������ %,h',h]��������������X;�ĭxiǭ���������%,�h]ǭ������������&,ȭha���%,(�+HC (�+X;� ȭp�,��+�,@,�,�,p,�,�,� ,�%,h]����������������&,����^��������������&,`%,����Xe����',(�+),��|p}0),P��_��),*,�[,!�*,�|p}�*,P��_������������P��_����������-,�+,,,�,,�1,02, 3,4,�9,�>,?,�@,�F,�G,�G,8I,�N,�c������(-,P,,-,h]���������������#,��h]���������������,���p����������2�+,,,h]���������������#,��p������������,,����Xe���,,`��������p-,4,�@,I,p[,�',x/,��|p}�/,P��_�X0,x0,�R,!1,�|p}81,P��_������������P��_����������U,�1,02, 3,4,�9,�>,?,�@,�F,�G,�G,8I,�N,�O,P,�P,h]��������������, �h]���������������+�xi����������2,��l�������������02,h2,3, 3,h]��������������#,��l������������������2,�2,^ ����������1,X3,����Xe��3,h],��������������,0�xi5����������4,/��p1���������-4,P4,`�������� 5,h@,�@,�-,(7,��|p}H7,P��_�8,(8,H8,�8,�|p}�8,P��_�>�4��������P��_����������:,�9,�>,?,h]Ӯ�������������,߮�nҮ��������5�9,`��������X:,(@,@@,�5,`<,��|p}�<,P��_�@=,`=,�=,>,�|p} >,P��_�����������P��_����������>,?,h]���������������,��h]���������������#,��xi�����������?,�`o����������&?,P?,^�����������>,�?,����Xe���?,f -��+,�h����hgή�9,:,X@,�����e#��+,�h����hg(��4,�4,�@,����h]?��������������,B�xiH���������XA,�xiG����������A,���pC���������-�@,pA,`��������@B,�G,�H,�-,HD,��|p}hD,P��_�(E,HE,hE,�E,�|p}F,P��_�K����������P��_����������F,�G,�G,h]���������������,¯xiů��������P`^ï���������F,G,����Xe��0G,h]ԯ�������������,ׯh]گ�������������#,ۯxiޯ��������8H,`oܯ��������&�G,H,^د���������G,PH,����Xeԯ�H,�h����hg;��A,�A,�H,����h]���������������,��xi�����������I,.�p����������-8I,pI,`��������@J,�R,�-,HL,��|p}hL,P��_�(M,HM,hM,�M,�|p}N,P��_��Ͱ�������P��_����������N,�O,P,�P,�Q,h]^��������������,f�xil���������0O,xik���������xO,�� �pg���������-�N,HO,h]y��������������,��h]���������������#,��^�����������O,P,����Xey�@P,h]��������������&,��xi����������Q,(�p����������-�P,�P,�n����������5(Q,h]��������������&,��xið��������R,0^�����������Q,�Q,����Xe��R,�h����hg��hQ,hR,�R,����hgZ��O,�P,�R,�����1,02, 3,4,�9,�>,?,�@,�F,�G,�G,8I,�N,�O,P,�P,�Q,�S,Z,h]װ�������������,߰xi����������`T,8xi�����������T,��@�p����������-�S,xT,�n����������5�T,`��������xU,[,�-,�W,��|p}�W,P��_�`X,�X,�X, Y,�|p}@Y,P��_������������P��_���������Z,h]��������������&,��xi����������hZ,Hxi�����������Z,��P^����������Z,�Z,����Xe���Z,�h����hgӰU,0U,0[,����hg���I,�I,@[,�����+,,,�,,�1,02, 3,4,�9,�>,?,�@,�F,�G,�G,8I,�N,�O,P,�P,�Q,�S,Z,��+X�+��+P�+��+��+��+��+�, ,H,,(,P,�,� ,h ,(,X,@,8,�,�,0,�,(,P,� ,8$,�%,�&,�+,,,�,,�1,02, 3,4,�9,�>,?,�@,�F,�G,�G,8I,�N,�O,P,�P,�Q,�S,Z,�^,�_,a,b,�b,c,Hd,�d,�j,�p,�q,r,�r,�s,h]���������������,��xi����������(_,Xxi����������p_,��`�p����������-�^,@_,h]ı�������������,DZxiͱ��������0`,hxi̱��������x`,��p�pȱ��������-�_,H`,`o�����������_,�`,h]�������������&,&�xi+���������xa,x�p'���������-a,Ha,`oϱ���������`,�a,h]|�������������&,��xi����������xb,��p����������-b,Hb,h]���������������,��h]���������������,��xi����������pc,�`o����������'c,@c,�p����������-�b,�c,`o�����������b,�c,h]���������������,òh]Ȳ�������������,ѲxiԲ���������d,�`oҲ��������&�d,�d,�pIJ��������-Hd,e,`o����������d,@e,`o-����������a,�e,`��������Hf,@z,(�+Ph,��|p}ph,P��_�0i,Pi,pi, �i,�|p}j,P��_�ز���������P��_����������l,�j,�p,�q,r,�r,�s,�t,v,�v,�w,�x,�x,h]���������������,��xi����������8k,�xi�����������k,����p����������-�j,Pk,�n����������5�k,`��������Pl,z,�f,Xn,��|p}xn,P��_�8o,Xo,xo, �o,�|p}p,P��_������������P��_����������p,�q,r,�r,�s,�t,v,�v,�w,�x,�x,h]���������������,�xi ���������@q,��p���������-�p,q,h]��������������,�`o���������Xq,�q,h]'���������������+*�xi*���������xr,p?l*�������������r,Hr,h]2���������������+5�xi5���������8s,h@l5��������������r,s,h]=���������������+A�xiA����������s, SlA��������������s,�s,`t,�t,�t,xiH����������t,�h]K��������������,N��lB�����������������t,Pt,^;���������Ps,u,����^0����������r,Xu,����Xe'��u,h]h���������������+k�xik���������xv,p?lk�������������v,Hv,h]s���������������+v�xiv���������8w,h@lv��������������v,w,h]~���������������+��xi�����������w, Sl���������������w,�w,`x,�x,�x,h]���������������,��h]���������������,���l������������������x,Px,^|���������Pw,�x,����^q����������v,Hy,����Xeh��y,hg���q,�u,�y,�����h����hg���k,l,0z,������+X�+��+P�+��+��+��+��+�, ,H,,(,P,�,� ,h ,(,X,@,8,�,�,0,�,(,P,� ,8$,�%,�&,�+,,,�,,�1,02, 3,4,�9,�>,?,�@,�F,�G,�G,8I,�N,�O,P,�P,�Q,�S,Z,�^,�_,a,b,�b,c,Hd,�d,�j,�p,�q,r,�r,�s,�t,v,�v,�w,�x,�x,x�,8�,��,@�,x�,p�,0�,h�,0�,��,��,�,�,З,��,��, �,��,؜,�,8�,��,��,��,p�,��,��,`���������~,��,��,(�+��,��|p}�,P��_�؁,��,X�,!��,�|p}��,P��_���״�������P��_���������(�,x�,8�,��,@�,x�,p�,0�,h�,0�,��,��,�,�,З,��,��,h]���������������,³xidz����������,��pó��������-x�,��,h]̳�������������,ֳ`oɳ����������,8�,`����������,X�,H�,p,�,��|p} �,P��_���,�, �,��,�|p}��,P��_�س4��������P��_�����������,@�,x�,p�,0�,h�,h]����������������+��xi������������,h@l����������������,��,h]����������������+��xi������������, Sl��������������@�,x�,�,0�,x�,xi����������`�,�h]���������������,��l��������������������,�,^�����������,��,����Xe���,h]���������������+�xi���������،,p?l�������������p�,��,h]���������������+�xi�����������, Sl�������������0�,h�,�, �,h�,xi$���������P�,�h]'��������������,*��l�������������������,��,^�����������,��,����Xe���,`����������,��,ؙ,p,��,��|p}Б,P��_���,��,В,P�,�|p}p�,P��_�:����������P��_���������0�,��,��,�,�,З,��,��,h]D���������������+G�xiG�����������,h@lG�������������0�,h�,h]O���������������+S�xiS���������X�, SlS���������������,(�,��,��,�,h]Z��������������,c�h]e��������������,m��lT�����������������p�,��,^M�����������,P�,����XeD���,h]x���������������+{�xi{���������x�,p?l{��������������,H�,h]����������������+��xi����������8�, Sl��������������З,�,��,��,��,h]���������������,��h]���������������,���l������������������P�,��,^������������,0�,����Xex���,hg��p�,��,`�,����h]����������������+��x�,8�,��,@�,x�,p�,0�,h�,0�,��,��,�,�,З,��,��, �,��,؜,�,xi������������,Al�������������� �,`�,h]����������������+��xi����������P�, Sl����������������, �,��,؜,�,h]´�������������,ʴh]̴�������������,ϴ�l������������������h�,��,^������������,H�,����Xe����,hg���e,f,�~,����h]���������������,��xi������������,��p����������08�,p�,h]����������������+��xi����������`�,�=l����������������,0�,h]���������������+�xi��������� �, Sl���������������,��,��,��,p�,xi ���������ؠ,�h]��������������,�xi���������X�,�`o���������'��,(�,�l�����������������8�,x�,^����������x�,��,����Xe���,h]+��������������,5�h]=���������������+@�xi@����������,�=l@���������������,��,xiG�����������,`^E���������(�,h�,����Xe=���,�h����hg'�p�,�,�,����hgݴ��,X�,(�,����h]X���������������+[�`fQ���,@�,P�+h�+8�+h�+�,�,,@,h,x,�,�,�$,�+,�,X�,��,HC (�+�� -����h]������������������,����ha����8�,(�+h]������������������,�����vg���������^���������������,Ȧ,����Xe������,�tg�����"��(�+�+�P��_���,��,��,g���+X�,.����xif�����P�,�;xik� ������,` �,h�,��������xir�#�����,�):](� �,V�~�xi}�&������,(�,ب,X�,��������xi��)������,�Sxi��,������ȩ,�,��������xi��/������,�)xi��2������h�,��,�������� j5������@)����h]�������������,��ha'�X�,�HC ��) -��^����������X�,�,����Xe������,h]��?����������,��xi��<����Ȭ,�Sl��9��������`�,��,h]��L��������)��xi��I������,�Sl��F�������� �,X�,h]��O��������)ŵ^��B������,��,0^��5������,�,2Xe��h�,h]ǵ\����������,̵�$ %�%&�&�-p/h��h5PO�)X�,`�, �,��,Ю,��,X�,H�,ȳ,��,(�,��,xi̵Y����@�,�)l̵V��������Ю,�,h]յi��������)ڵxiڵf�����,�)lڵc����������,а,h]��l����������,��^��_�����,X�,4^ӵR����X�,��,6Xeǵ��,h]��{����80�,��platform]0���,�-��xi��x������,��,l��u����:H�,��,xi�~����p�,�S�p�r����-�,@�,h]����������h(�xi������0�,�#l����������ȳ,�,h]!����������)&�^������H�,��,��������,��,>Xe/� �,hg����,�,p�,o�t ����d��+��P��_���,0�,0�,Xe��,�t���������� �P��_��,�,�,����HC ��$����h]���� ���������,����^��������X�,��,����h]K����������,����`fK���,HC ���������HC �(���������HC �H$���������45P5�6.this_function]�H�,�s�p�p����x���8�8������ �� -���`�����(�h�(�P�`�`� � -`:�:�:�<�< ?@C0�YXY�Y \p^�``i�qX��� �� -@� x� �� ��}��9�@:��:��;��>�B��F��H�J�b� e� -(�� (� HL��L��L��M� Q��U�����z�8{��{������@��`��@��ؤ�0�� �-�0.�x.� 0�h0�7�<�XF��V��i� l� -h|� H�� p�� @�����������P��p3��3�4�5��@��I� �h���������x������������� ��� -��� @@� Ї�H��� �0n�xn��n��o�@p�0w�{�}��~���� ��� -�M�-�X-��-��.��1�@4�8�:�`<��C� ���Ѝ��������Ȥ�����0����� ��x��p��h�� h�� -�( ��( P�( ��(��(�(�))P)�!)�#)P%)P-)�6)@o)�o)�o)�p)Xw)|)��)��)0�)0�)�)X�)��)��)�)h�)��)�)H�)��)��)��)��)(�)8�)h�) (* -P* �* � -* hN*�R*@a*p�*��*�*�*h�*��*��*��*��*��*��*��*��*@ +��*��*0�*h�*��*P�*(�* �*��*��* ��* -X�+�~+�~+(+(�+@�+P�+(�+ �+0�+��+ �+h�+��+��+0�+x�+��+��+��+�,�,�,�,�, �, -�, �#, &, �!x"#�' (h(0*x*�/Ȗ p� -�5 �R ) ��,0�,x�,��,�' (h(0*x*�/Ȗ p� -�5 �R ) ��,�,0�,x�,��, diff --git a/Chapter03/working-with-files/incremental-processing/file.dat b/Chapter03/working-with-files/incremental-processing/file.dat deleted file mode 100644 index 6a97696..0000000 Binary files a/Chapter03/working-with-files/incremental-processing/file.dat and /dev/null differ diff --git a/Chapter03/working-with-files/incremental-processing/log.txt b/Chapter03/working-with-files/incremental-processing/log.txt deleted file mode 100644 index d210d7f..0000000 --- a/Chapter03/working-with-files/incremental-processing/log.txt +++ /dev/null @@ -1,4 +0,0 @@ -Wed Jun 08 2016 23:48:13 GMT+0100 (BST) 896977 bytes removed -Wed Jun 08 2016 23:48:17 GMT+0100 (BST) 896977 bytes removed -Wed Jun 08 2016 23:49:25 GMT+0100 (BST) 896977 bytes removed -Wed Jun 08 2016 23:50:17 GMT+0100 (BST) 896977 bytes removed diff --git a/Chapter03/working-with-files/incremental-processing/null-byte-remover.js b/Chapter03/working-with-files/incremental-processing/null-byte-remover.js deleted file mode 100644 index 9a57267..0000000 --- a/Chapter03/working-with-files/incremental-processing/null-byte-remover.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -setInterval(() => process.stdout.write('.'), 10).unref() - -const fs = require('fs') -const path = require('path') -const cwd = process.cwd() - -const sbs = require('strip-bytes-stream') - -fs.createReadStream(path.join(cwd, 'file.dat')) - .pipe(sbs((n) => n)) - .on('end', function () { log(this.total) }) - .pipe(fs.createWriteStream(path.join(cwd, 'clean.dat'))) - -function log(total) { - fs.appendFile( - path.join(cwd, 'log.txt'), - (new Date) + ' ' + total + ' bytes removed\n' - ) -} - - diff --git a/Chapter03/working-with-files/incremental-processing/package.json b/Chapter03/working-with-files/incremental-processing/package.json deleted file mode 100644 index 859e5c4..0000000 --- a/Chapter03/working-with-files/incremental-processing/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "piping", - "version": "1.0.0", - "description": "", - "main": "null-byte-remover.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "strip-bytes-stream": "^1.1.0" - } -} diff --git a/Chapter03/working-with-files/log.txt b/Chapter03/working-with-files/log.txt deleted file mode 100644 index 4706c31..0000000 --- a/Chapter03/working-with-files/log.txt +++ /dev/null @@ -1,6 +0,0 @@ -Wed Jun 08 2016 22:56:41 GMT+0100 (BST) 100000000 bytes removed -Wed Jun 08 2016 22:56:54 GMT+0100 (BST) 897090 bytes removed -Wed Jun 08 2016 22:58:02 GMT+0100 (BST) 897090 bytes removed -Wed Jun 08 2016 22:58:03 GMT+0100 (BST) 897090 bytes removed -Wed Jun 08 2016 22:58:15 GMT+0100 (BST) 897090 bytes removed -Wed Jun 08 2016 22:59:08 GMT+0100 (BST) 897090 bytes removed diff --git a/Chapter03/working-with-files/null-byte-remover.js b/Chapter03/working-with-files/null-byte-remover.js deleted file mode 100644 index e891808..0000000 --- a/Chapter03/working-with-files/null-byte-remover.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -const fs = require('fs') -const path = require('path') -const cwd = process.cwd() -const bytes = fs.readFileSync(path.join(cwd, 'file.dat')) - -const clean = bytes.filter(n => n) -fs.writeFileSync(path.join(cwd, 'clean.dat'), clean) - -fs.appendFileSync( - path.join(cwd, 'log.txt'), - (new Date) + ' ' + (bytes.length - clean.length) + ' bytes removed\n' -) - diff --git a/Chapter08/anticipating-malicious-input/app/index-fixed.js b/Chapter08/anticipating-malicious-input/app/index-fixed.js deleted file mode 100644 index 1de4afa..0000000 --- a/Chapter08/anticipating-malicious-input/app/index-fixed.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' - -const express = require('express') -const app = express() - -app.get('/', (req, res) => { - pretendDbQuery(() => { - var msg = req.query.msg - - if (Array.isArray(msg)) msg = msg.pop() - - const yelling = (msg || '').toUpperCase() - res.send(yelling) - }) -}) - -app.listen(3000) - -function pretendDbQuery (cb) { - setTimeout(cb, 0) -} diff --git a/Chapter08/anticipating-malicious-input/app/index.js b/Chapter08/anticipating-malicious-input/app/index.js deleted file mode 100644 index 120c6ae..0000000 --- a/Chapter08/anticipating-malicious-input/app/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -const express = require('express') -const app = express() - -app.get('/', (req, res) => { - pretendDbQuery(() => { - const yelling = (req.query.msg || '').toUpperCase() - res.send(yelling) - }) -}) - -app.listen(3000) - -function pretendDbQuery (cb) { - setTimeout(cb, 0) -} diff --git a/Chapter08/anticipating-malicious-input/app/package.json b/Chapter08/anticipating-malicious-input/app/package.json deleted file mode 100644 index 8711bc5..0000000 --- a/Chapter08/anticipating-malicious-input/app/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - } -} diff --git a/Chapter08/anticipating-malicious-input/buffer-safety/index-fixed.js b/Chapter08/anticipating-malicious-input/buffer-safety/index-fixed.js deleted file mode 100644 index d40f2c2..0000000 --- a/Chapter08/anticipating-malicious-input/buffer-safety/index-fixed.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict' - -const http = require('http') - -const server = http.createServer((req, res) => { - if (req.method === 'GET') { - res.setHeader('Content-Type', 'text/html') - if (req.url === '/') return res.end(html()) - res.setHeader('Content-Type', 'application/json') - if (req.url === '/friends') return res.end(friends()) - - return - } - if (req.method === 'POST') { - if (req.url === '/') return action(req, res) - } -}) - -function html (res) { - return ` -
-
- -
- - ` -} - -function friends () { - return JSON.stringify(friends.list) -} -friends.list = [Buffer.from('Dave').toString('base64')] -friends.add = (friend) => { - friends.list.push(Buffer.from(friend).toString('base64')) -} - -function action (req, res) { - var data = '' - req.on('data', (chunk) => data += chunk) - req.on('end', () => { - try { - data = JSON.parse(data) - } catch (e) { - console.error(e) - res.end('{"ok": false}') - return - } - if (data.cmd === 'add') { - try { - friends.add(data.friend) - } catch (e) { - console.error(e) - res.end('{"ok": false}') - } - } - }) -} - -server.listen(3000) \ No newline at end of file diff --git a/Chapter08/anticipating-malicious-input/buffer-safety/index.js b/Chapter08/anticipating-malicious-input/buffer-safety/index.js deleted file mode 100644 index a155ac8..0000000 --- a/Chapter08/anticipating-malicious-input/buffer-safety/index.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict' - -const http = require('http') - -const server = http.createServer((req, res) => { - if (req.method === 'GET') { - res.setHeader('Content-Type', 'text/html') - if (req.url === '/') return res.end(html()) - res.setHeader('Content-Type', 'application/json') - if (req.url === '/friends') return res.end(friends()) - - return - } - if (req.method === 'POST') { - if (req.url === '/') return action(req, res) - } -}) - -function html (res) { - return ` -
-
- -
- - ` -} - -function friends () { - return JSON.stringify(friends.list) -} -friends.list = [Buffer('Dave').toString('base64')] -friends.add = (friend) => friends.list.push(Buffer(friend).toString('base64')) - -function action (req, res) { - var data = '' - req.on('data', (chunk) => data += chunk) - req.on('end', () => { - try { - data = JSON.parse(data) - } catch (e) { - res.end('{"ok": false}') - return - } - if (data.cmd === 'add') { - friends.add(data.friend) - } - res.end('{"ok": true}') - }) -} - -server.listen(3000) \ No newline at end of file diff --git a/Chapter08/anticipating-malicious-input/json-validation/index-fixed.js b/Chapter08/anticipating-malicious-input/json-validation/index-fixed.js deleted file mode 100644 index 2ccb7f6..0000000 --- a/Chapter08/anticipating-malicious-input/json-validation/index-fixed.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict' - -const http = require('http') -const Ajv = require('ajv') -const ajv = new Ajv -const schema = { - title: 'UserReg', - properties: { - id: {type: 'integer'}, - name: {type: 'string'}, - privileges: { - anyOf: [ - {type: 'string'}, - {type: 'boolean'}, - {type: 'array', items: {type: 'string'}}, - {type: 'object'} - ] - } - }, - additionalProperties: false, - required: ['id', 'name'] -} -const validate = ajv.compile(schema) -const {STATUS_CODES} = http - -const server = http.createServer((req, res) => { - - if (req.method !== 'POST') { - res.statusCode = 404 - res.end(STATUS_CODES[res.statusCode]) - return - } - if (req.url === '/register') { - register(req, res) - return - } - res.statusCode = 404 - res.end(STATUS_CODES[res.statusCode]) - -}) - -function register (req, res) { - var data = '' - req.on('data', (chunk) => data += chunk) - req.on('end', () => { - try { - data = JSON.parse(data) - } catch (e) { - res.end('{"ok": false}') - return - } - const valid = validate(data, schema) - if (!valid) { - console.error(validate.errors) - res.end('{"ok": false}') - return - } - - if (data.hasOwnProperty('privileges')) { - createAdminUser(data) - res.end('{"ok": true, "admin": true}') - } else { - createUser(data) - res.end('{"ok": true, "admin": false}') - } - }) -} - -function createAdminUser (user) { - const key = user.id + user.name - // ... -} - -function createUser (user) { - // ... -} - -server.listen(3000) \ No newline at end of file diff --git a/Chapter08/anticipating-malicious-input/json-validation/index.js b/Chapter08/anticipating-malicious-input/json-validation/index.js deleted file mode 100644 index 9b39327..0000000 --- a/Chapter08/anticipating-malicious-input/json-validation/index.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict' - -const http = require('http') -const {STATUS_CODES} = http - -const server = http.createServer((req, res) => { - - if (req.method !== 'POST') { - res.statusCode = 404 - res.end(STATUS_CODES[res.statusCode]) - return - } - if (req.url === '/register') { - register(req, res) - return - } - res.statusCode = 404 - res.end(STATUS_CODES[res.statusCode]) - -}) - -function register (req, res) { - var data = '' - req.on('data', (chunk) => data += chunk) - req.on('end', () => { - try { - data = JSON.parse(data) - } catch (e) { - res.end('{"ok": false}') - return - } - // privileges can be multiple types, boolean, array, object, string, - // but the presence of the key means the user is an admin - if (data.hasOwnProperty('privileges')) { - createAdminUser(data) - res.end('{"ok": true, "admin": true}') - } else { - createUser(data) - res.end('{"ok": true, "admin": false}') - } - }) -} - -function createAdminUser (user) { - const key = user.id + user.name - // ... -} - -function createUser (user) { - // ... -} - -server.listen(3000) \ No newline at end of file diff --git a/Chapter08/anticipating-malicious-input/json-validation/package.json b/Chapter08/anticipating-malicious-input/json-validation/package.json deleted file mode 100644 index 23855f0..0000000 --- a/Chapter08/anticipating-malicious-input/json-validation/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "json-validation", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "ajv": "^4.11.5" - } -} diff --git a/Chapter08/detecting-dependency-vulnerabilities/app/.snyk b/Chapter08/detecting-dependency-vulnerabilities/app/.snyk deleted file mode 100644 index 127718e..0000000 --- a/Chapter08/detecting-dependency-vulnerabilities/app/.snyk +++ /dev/null @@ -1,4 +0,0 @@ -# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. -version: v1.7.0 -ignore: {} -patch: {} diff --git a/Chapter08/detecting-dependency-vulnerabilities/app/package.json b/Chapter08/detecting-dependency-vulnerabilities/app/package.json deleted file mode 100644 index e449c98..0000000 --- a/Chapter08/detecting-dependency-vulnerabilities/app/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "audit": "auditjs" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - }, - "devDependencies": { - "auditjs": "^2.0.2" - } -} diff --git a/Chapter08/guarding-against-xss/app/index.js b/Chapter08/guarding-against-xss/app/index.js deleted file mode 100644 index 5bd2a69..0000000 --- a/Chapter08/guarding-against-xss/app/index.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict' - -const express = require('express') -const app = express() - -app.get('/', (req, res) => { - const {prev = '', handoverToken = '', lang = 'en'} = req.query - pretendDbQuery((err, status) => { - if (err) { - res.sendStatus(500) - return - } - res.send(` -

Current Status

-
- ${status} -
- - `) - }) - -}) - -function pretendDbQuery (cb) { - const status = 'ON FIRE!!! HELP!!!' - cb(null, status) -} - - -app.listen(3000) \ No newline at end of file diff --git a/Chapter08/guarding-against-xss/app/package.json b/Chapter08/guarding-against-xss/app/package.json deleted file mode 100644 index 8711bc5..0000000 --- a/Chapter08/guarding-against-xss/app/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - } -} diff --git a/Chapter08/guarding-against-xss/fixed-app/index.js b/Chapter08/guarding-against-xss/fixed-app/index.js deleted file mode 100644 index 5bc4145..0000000 --- a/Chapter08/guarding-against-xss/fixed-app/index.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict' - -const express = require('express') -const he = require('he') -const app = express() - - -app.get('/', (req, res) => { - const {prev = '', handoverToken = '', lang = 'en'} = req.query - pretendDbQuery((err, status) => { - if (err) { - res.sendStatus(500) - return - } - const href = he.encode(`${prev}${handoverToken}/${lang}`) - res.send(` -

Current Status

-
- ${he.escape(status)} -
-
- Back to Control HQ - `) - }) - -}) - -function pretendDbQuery (cb) { - const status = 'ON FIRE!!! HELP!!!' - cb(null, status) -} - - -app.listen(3000) \ No newline at end of file diff --git a/Chapter08/guarding-against-xss/fixed-app/package.json b/Chapter08/guarding-against-xss/fixed-app/package.json deleted file mode 100644 index f6f3dbc..0000000 --- a/Chapter08/guarding-against-xss/fixed-app/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.15.2", - "he": "^1.1.1" - } -} diff --git a/Chapter08/guarding-against-xss/fully-escaped-app/index.js b/Chapter08/guarding-against-xss/fully-escaped-app/index.js deleted file mode 100644 index 36251e0..0000000 --- a/Chapter08/guarding-against-xss/fully-escaped-app/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -const express = require('express') -const escapeHtml = require('escape-html') -const app = express() - - -app.get('/', (req, res) => { - const {prev = '', handoverToken = '', lang = 'en'} = req.query - pretendDbQuery((err, status) => { - if (err) { - res.sendStatus(500) - return - } - const href = escapeHtml(`/${prev}${handoverToken}/${lang}`) - res.send(` -

Current Status

-
- ${escapeHtml(status)} -
-
- Back to Control HQ - `) - }) -}) - -function pretendDbQuery (cb) { - const status = 'ON FIRE!!! HELP!!!' - cb(null, status) -} - - -app.listen(3000) \ No newline at end of file diff --git a/Chapter08/guarding-against-xss/fully-escaped-app/package.json b/Chapter08/guarding-against-xss/fully-escaped-app/package.json deleted file mode 100644 index c18daca..0000000 --- a/Chapter08/guarding-against-xss/fully-escaped-app/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "escape-html": "^1.0.3", - "express": "^4.15.2", - "he": "^1.1.1" - } -} diff --git a/Chapter08/guarding-against-xss/param-constraints-app/index.js b/Chapter08/guarding-against-xss/param-constraints-app/index.js deleted file mode 100644 index 955a110..0000000 --- a/Chapter08/guarding-against-xss/param-constraints-app/index.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict' - -const express = require('express') -const app = express() - -function validate ({prev, handoverToken, lang}, query) { - var valid = Object.keys(query).length <= 3 - valid = valid && typeof lang === 'string' && lang.length === 2 - valid = valid && typeof handoverToken === 'string' && handoverToken.length === 16 - valid = valid && typeof prev === 'string' && prev.length < 10 - return valid -} - -app.get('/', (req, res) => { - const {prev = '', handoverToken = '', lang = 'en'} = req.query - - if (!validate({prev, handoverToken, lang}, req.query)) { - res.sendStatus(422) - return - } - - pretendDbQuery((err, status) => { - if (err) { - res.sendStatus(500) - return - } - res.send(` -

Current Status

-
- ${status} -
- - `) - }) - -}) - -function pretendDbQuery (cb) { - const status = 'ON FIRE!!! HELP!!!' - cb(null, status) -} - - -app.listen(3000) \ No newline at end of file diff --git a/Chapter08/guarding-against-xss/param-constraints-app/package.json b/Chapter08/guarding-against-xss/param-constraints-app/package.json deleted file mode 100644 index a09118c..0000000 --- a/Chapter08/guarding-against-xss/param-constraints-app/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "escape-html": "^1.0.3", - "express": "^4.15.2" - } -} diff --git a/Chapter08/guarding-against-xss/protocol-safe-app/index.js b/Chapter08/guarding-against-xss/protocol-safe-app/index.js deleted file mode 100644 index 36251e0..0000000 --- a/Chapter08/guarding-against-xss/protocol-safe-app/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -const express = require('express') -const escapeHtml = require('escape-html') -const app = express() - - -app.get('/', (req, res) => { - const {prev = '', handoverToken = '', lang = 'en'} = req.query - pretendDbQuery((err, status) => { - if (err) { - res.sendStatus(500) - return - } - const href = escapeHtml(`/${prev}${handoverToken}/${lang}`) - res.send(` -

Current Status

-
- ${escapeHtml(status)} -
-
- Back to Control HQ - `) - }) -}) - -function pretendDbQuery (cb) { - const status = 'ON FIRE!!! HELP!!!' - cb(null, status) -} - - -app.listen(3000) \ No newline at end of file diff --git a/Chapter08/guarding-against-xss/protocol-safe-app/package.json b/Chapter08/guarding-against-xss/protocol-safe-app/package.json deleted file mode 100644 index a09118c..0000000 --- a/Chapter08/guarding-against-xss/protocol-safe-app/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "escape-html": "^1.0.3", - "express": "^4.15.2" - } -} diff --git a/Chapter08/preventing-cross-site-request-forgery/app/index.js b/Chapter08/preventing-cross-site-request-forgery/app/index.js deleted file mode 100644 index c541738..0000000 --- a/Chapter08/preventing-cross-site-request-forgery/app/index.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict' - -const express = require('express') -const bodyParser = require('body-parser') -const session = require('express-session') -const he = require('he') -const app = express() - -const pretendData = { - dave: { - ac: '12345678', - sc: '88-26-26' - } -} - -app.use(session({ - secret: 'AI overlords are coming', - name: 'SESSIONID', - resave: false, - saveUninitialized: false -})) - -app.use(bodyParser.urlencoded({extended: false})) - -app.get('/', (req, res) => { - if (req.session.user) return res.redirect('/profile') - res.send(` -

Login

-
-
-
- -
- `) -}) - -app.post('/', (req, res) => { - if (req.body.user === 'dave' && req.body.pass === 'ncb') { - req.session.user = req.body.user - } - if (req.session.user) res.redirect('/profile') - else res.redirect('/') -}) - -app.get('/profile', (req, res) => { - if (!req.session.user) return res.redirect('/') - const {prev = '', handoverToken = '', lang = 'en'} = req.query - pretendDbQuery(req.session.user, (err, {sc, ac}) => { - if (err) { - res.sendStatus(500) - return - } - sc = he.encode(sc) - ac = he.encode(ac) - res.send(` -

Employee Payment Profile

-
-
-
- -
- `) - }) -}) - -app.post('/update', (req, res) => { - if (!req.session.user) return res.sendStatus(403) - pretendData[req.session.user].ac = req.body.ac - pretendData[req.session.user].sc = req.body.sc - res.send(` -

updated

- - `) -}) - -function pretendDbQuery (user, cb) { - cb(null, pretendData[user]) -} - -app.listen(3000) diff --git a/Chapter08/preventing-cross-site-request-forgery/app/package.json b/Chapter08/preventing-cross-site-request-forgery/app/package.json deleted file mode 100644 index b7d89f0..0000000 --- a/Chapter08/preventing-cross-site-request-forgery/app/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "body-parser": "^1.17.1", - "express": "^4.15.2", - "express-session": "^1.15.2", - "he": "^1.1.1" - } -} diff --git a/Chapter08/preventing-cross-site-request-forgery/attacker/index.js b/Chapter08/preventing-cross-site-request-forgery/attacker/index.js deleted file mode 100644 index 747e3e8..0000000 --- a/Chapter08/preventing-cross-site-request-forgery/attacker/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const http = require('http') - -const attackerAc = '87654321' -const attackerSc = '11-11-11' -const attackerMsg = 'Everything you could ever want is only one click away' - -const server = http.createServer((req, res) => { - res.writeHead(200, {'Content-Type': 'text/html'}) - res.end(` - -
- - - -
- `) -}) - -server.listen(3001) \ No newline at end of file diff --git a/Chapter08/preventing-cross-site-request-forgery/fixed-app/index.js b/Chapter08/preventing-cross-site-request-forgery/fixed-app/index.js deleted file mode 100644 index 36aa5c9..0000000 --- a/Chapter08/preventing-cross-site-request-forgery/fixed-app/index.js +++ /dev/null @@ -1,83 +0,0 @@ -'use strict' - -const express = require('express') -const bodyParser = require('body-parser') -const session = require('express-session') -const he = require('he') -const app = express() - -const pretendData = { - dave: { - ac: '12345678', - sc: '88-26-26' - } -} - -app.use(session({ - secret: 'AI overlords are coming', - name: 'SESSIONID', - resave: false, - saveUninitialized: false, - cookie: { - sameSite: true - } -})) - -app.use(bodyParser.urlencoded({extended: false})) - -app.get('/', (req, res) => { - if (req.session.user) return res.redirect('/profile') - res.send(` -

Login

-
-
-
- -
- `) -}) - -app.post('/', (req, res) => { - if (req.body.user === 'dave' && req.body.pass === 'ncb') { - req.session.user = req.body.user - } - if (req.session.user) res.redirect('/profile') - else res.redirect('/') -}) - -app.get('/profile', (req, res) => { - if (!req.session.user) return res.redirect('/') - const {prev = '', handoverToken = '', lang = 'en'} = req.query - pretendDbQuery(req.session.user, (err, {sc, ac}) => { - if (err) { - res.sendStatus(500) - return - } - sc = he.encode(sc) - ac = he.encode(ac) - res.send(` -

Employee Payment Profile

-
-
-
- -
- `) - }) -}) - -app.post('/update', (req, res) => { - if (!req.session.user) return res.sendStatus(403) - pretendData[req.session.user].ac = req.body.ac - pretendData[req.session.user].sc = req.body.sc - res.send(` -

updated

- - `) -}) - -function pretendDbQuery (user, cb) { - cb(null, pretendData[user]) -} - -app.listen(3000) diff --git a/Chapter08/preventing-cross-site-request-forgery/fixed-app/package.json b/Chapter08/preventing-cross-site-request-forgery/fixed-app/package.json deleted file mode 100644 index b7d89f0..0000000 --- a/Chapter08/preventing-cross-site-request-forgery/fixed-app/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "body-parser": "^1.17.1", - "express": "^4.15.2", - "express-session": "^1.15.2", - "he": "^1.1.1" - } -} diff --git a/Chapter08/preventing-cross-site-request-forgery/secured-app/index.js b/Chapter08/preventing-cross-site-request-forgery/secured-app/index.js deleted file mode 100644 index 90a8a22..0000000 --- a/Chapter08/preventing-cross-site-request-forgery/secured-app/index.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict' - -const express = require('express') -const bodyParser = require('body-parser') -const session = require('express-session') -const he = require('he') -const csurf = require('csurf') -const app = express() -const csrf = csurf() - -const pretendData = { - dave: { - ac: '12345678', - sc: '88-26-26' - } -} - -app.use(session({ - secret: 'AI overlords are coming', - name: 'SESSIONID', - resave: false, - saveUninitialized: false, - cookie: { - sameSite: true - } -})) - -app.use(bodyParser.urlencoded({extended: false})) - -app.get('/', (req, res) => { - if (req.session.user) return res.redirect('/profile') - res.send(` -

Login

-
-
-
- -
- `) -}) - -app.post('/', (req, res) => { - if (req.body.user === 'dave' && req.body.pass === 'ncb') { - req.session.user = req.body.user - } - if (req.session.user) res.redirect('/profile') - else res.redirect('/') -}) - -app.get('/profile', csrf, (req, res) => { - if (!req.session.user) return res.redirect('/') - const {prev = '', handoverToken = '', lang = 'en'} = req.query - pretendDbQuery(req.session.user, (err, {sc, ac}) => { - if (err) { - res.sendStatus(500) - return - } - sc = he.encode(sc) - ac = he.encode(ac) - res.send(` -

Employee Payment Profile

-
- -
-
- -
- `) - }) -}) - -app.post('/update', csrf, (req, res) => { - if (!req.session.user) return res.sendStatus(403) - pretendData[req.session.user].ac = req.body.ac - pretendData[req.session.user].sc = req.body.sc - res.send(` -

updated

- - `) -}) - -function pretendDbQuery (user, cb) { - cb(null, pretendData[user]) -} - -app.listen(3000) diff --git a/Chapter08/preventing-cross-site-request-forgery/secured-app/package.json b/Chapter08/preventing-cross-site-request-forgery/secured-app/package.json deleted file mode 100644 index 86cf66b..0000000 --- a/Chapter08/preventing-cross-site-request-forgery/secured-app/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "app", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "body-parser": "^1.17.1", - "csurf": "^1.9.0", - "express": "^4.15.2", - "express-session": "^1.15.2", - "he": "^1.1.1" - } -} diff --git a/Chapter08/web-server-hardening/app/app.js b/Chapter08/web-server-hardening/app/app.js deleted file mode 100644 index 1e9ad86..0000000 --- a/Chapter08/web-server-hardening/app/app.js +++ /dev/null @@ -1,47 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') -var helmet = require('helmet') -var index = require('./routes/index') -var users = require('./routes/users') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'jade') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(helmet()) -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter08/web-server-hardening/app/bin/www b/Chapter08/web-server-hardening/app/bin/www deleted file mode 100644 index a8c2d36..0000000 --- a/Chapter08/web-server-hardening/app/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('app:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter08/web-server-hardening/app/package.json b/Chapter08/web-server-hardening/app/package.json deleted file mode 100644 index 35569d5..0000000 --- a/Chapter08/web-server-hardening/app/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "app", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "express": "~4.14.1", - "helmet": "^3.5.0", - "jade": "~1.11.0", - "morgan": "~1.7.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter08/web-server-hardening/app/public/stylesheets/style.css b/Chapter08/web-server-hardening/app/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter08/web-server-hardening/app/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter08/web-server-hardening/app/routes/index.js b/Chapter08/web-server-hardening/app/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter08/web-server-hardening/app/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter08/web-server-hardening/app/routes/users.js b/Chapter08/web-server-hardening/app/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter08/web-server-hardening/app/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter08/web-server-hardening/app/views/error.jade b/Chapter08/web-server-hardening/app/views/error.jade deleted file mode 100644 index 51ec12c..0000000 --- a/Chapter08/web-server-hardening/app/views/error.jade +++ /dev/null @@ -1,6 +0,0 @@ -extends layout - -block content - h1= message - h2= error.status - pre #{error.stack} diff --git a/Chapter08/web-server-hardening/app/views/index.jade b/Chapter08/web-server-hardening/app/views/index.jade deleted file mode 100644 index 3d63b9a..0000000 --- a/Chapter08/web-server-hardening/app/views/index.jade +++ /dev/null @@ -1,5 +0,0 @@ -extends layout - -block content - h1= title - p Welcome to #{title} diff --git a/Chapter08/web-server-hardening/app/views/layout.jade b/Chapter08/web-server-hardening/app/views/layout.jade deleted file mode 100644 index 15af079..0000000 --- a/Chapter08/web-server-hardening/app/views/layout.jade +++ /dev/null @@ -1,7 +0,0 @@ -doctype html -html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.css') - body - block content diff --git a/Chapter08/web-server-hardening/hapi-app/.gitignore b/Chapter08/web-server-hardening/hapi-app/.gitignore deleted file mode 100644 index 40b878d..0000000 --- a/Chapter08/web-server-hardening/hapi-app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/LICENSE b/Chapter08/web-server-hardening/hapi-app/LICENSE deleted file mode 100644 index b253f47..0000000 --- a/Chapter08/web-server-hardening/hapi-app/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Azaritech - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Chapter08/web-server-hardening/hapi-app/README.md b/Chapter08/web-server-hardening/hapi-app/README.md deleted file mode 100644 index 1fb3729..0000000 --- a/Chapter08/web-server-hardening/hapi-app/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# hapi-starter-kit -Starter kit for Hapi - -## Install -```bash -git clone git@github.com:azaritech/hapi-starter-kit.git -cd hapi-starter-kit/ -yarn install -# or -npm install -``` - -## Start -```bash -npm run start -``` - -### Open browser and go to -[http://localhost:3000/](http://localhost:3000/) - -[http://localhost:3000/hello](http://localhost:3000/hello) diff --git a/Chapter08/web-server-hardening/hapi-app/config/default.json b/Chapter08/web-server-hardening/hapi-app/config/default.json deleted file mode 100644 index cc83a42..0000000 --- a/Chapter08/web-server-hardening/hapi-app/config/default.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "connections": - [ - { - "server": { - "port": 3000, - "host": "0.0.0.0", - "labels": ["server"] - } - } - ] -} \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/lib/index.js b/Chapter08/web-server-hardening/hapi-app/lib/index.js deleted file mode 100644 index 5b9dab6..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/index.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -const util = require('util'); -const hapi = require('hapi'); -const config = require('getconfig'); - -const init = require('./init'); -const server = new hapi.Server(); - -// init connections before registering plugins -init.connections(server, config); -server.ext('onPreResponse', (request, reply) => { - var response = request.response.isBoom ? - request.response.output : - request.response; - response.headers['X-DNS-Prefetch-Control'] = 'off'; - response.headers['X-DNS-Prefetch-Control'] = 'off'; - response.headers['X-Frame-Options'] = 'SAMEORIGIN'; - response.headers['X-Download-Options'] = 'noopen'; - response.headers['X-Content-Type-Options'] = 'nosniff'; - response.headers['X-XSS-Protection'] = '1; mode=block'; - reply.continue(); -}); -// register plugins -init.registers(server); -// loading views -init.views(server); - -server.start((err) => { - if (err) { - throw err; - } - server.log('info', 'Server running'); -}); \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/lib/init.js b/Chapter08/web-server-hardening/hapi-app/lib/init.js deleted file mode 100644 index 071838a..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/init.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -module.exports.connections = function(server, config) { - require('./server').connection(server, config); -}; - -module.exports.registers = function(server) { - server.register([{ - register: require('./logs').register, - options: require('./logs').options - }, { - register: require('nes') - }, { - register: require('vision') - }, { - register: require('inert') - }, { - register: require('./server').register, - select: ['server'] - }], (err) => { - if (err) { - throw err; - } - }); -}; - -module.exports.views = function(server) { - server.views({ - engines: { - html: require('handlebars') - }, - path: __dirname + '/views', - layout: false - //layoutPath: 'views/layout', - //layout: 'default', - //helpersPath: 'views/helpers', - //partialsPath: 'views/partials' - }); -} \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/lib/logs.js b/Chapter08/web-server-hardening/hapi-app/lib/logs.js deleted file mode 100644 index 3e0d146..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/logs.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -// logging to console -const logs = { - register: require('good'), - options: { - ops: { - interval: 60 * 1000 - }, - reporters: { - console: [{ - module: 'good-console', - args: [ { log: '*', response: '*', request: '*' } ] - }, - 'stdout' - ] - } - } -}; - -module.exports = logs; \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/lib/server/index.js b/Chapter08/web-server-hardening/hapi-app/lib/server/index.js deleted file mode 100644 index 8d3b4ef..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/server/index.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -module.exports.connection = function(server, config) { - server.connection({ - host: config.connections[0].server.host, - port: config.connections[0].server.port, - labels: config.connections[0].server.labels - }); -}; - -// register plugin -module.exports.register = function (server, options, next) { - require('./routes')(server); - next(); -}; - -module.exports.register.attributes = { - pkg: require('./package.json') -}; \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/lib/server/package.json b/Chapter08/web-server-hardening/hapi-app/lib/server/package.json deleted file mode 100644 index 69a979e..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/server/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "server", - "version": "1.0.0" -} \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/lib/server/routes.js b/Chapter08/web-server-hardening/hapi-app/lib/server/routes.js deleted file mode 100644 index 2eb3f5d..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/server/routes.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -module.exports = function(server) { - server.route({ - method: 'GET', - path: '/', - handler: function (request, reply) { - reply.view('index'); - } - }); - server.route({ - method: 'GET', - path: '/hello', - handler: function (request, reply) { - const data = { - message1: 'Hello', - message2: 'Paris, France' - }; - reply.view('hello', data); - } - }); -}; diff --git a/Chapter08/web-server-hardening/hapi-app/lib/views/hello.html b/Chapter08/web-server-hardening/hapi-app/lib/views/hello.html deleted file mode 100644 index e5ea604..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/views/hello.html +++ /dev/null @@ -1 +0,0 @@ -{{message1}} from {{message2}}. \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/lib/views/index.html b/Chapter08/web-server-hardening/hapi-app/lib/views/index.html deleted file mode 100644 index a403e71..0000000 --- a/Chapter08/web-server-hardening/hapi-app/lib/views/index.html +++ /dev/null @@ -1 +0,0 @@ -Hapi Starter Kit \ No newline at end of file diff --git a/Chapter08/web-server-hardening/hapi-app/package.json b/Chapter08/web-server-hardening/hapi-app/package.json deleted file mode 100644 index 8ae93a3..0000000 --- a/Chapter08/web-server-hardening/hapi-app/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "hapi-starter-kit", - "version": "1.0.2", - "description": "Starter kit for Hapi", - "main": "lib/index.js", - "repository": "git@github.com:azaritech/hapi-starter-kit.git", - "author": "Nicolas Azari", - "license": "MIT", - "scripts": { - "start": "node lib/index.js", - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { - "getconfig": "^3.0.0", - "good": "^7.1.0", - "good-console": "^6.4.0", - "handlebars": "^4.0.6", - "hapi": "^16.1.0", - "inert": "^4.1.0", - "nes": "^6.4.0", - "vision": "^4.1.1" - }, - "devDependencies": {} -} diff --git a/Chapter08/web-server-hardening/hapi-app/yarn.lock b/Chapter08/web-server-hardening/hapi-app/yarn.lock deleted file mode 100644 index 8ef51d4..0000000 --- a/Chapter08/web-server-hardening/hapi-app/yarn.lock +++ /dev/null @@ -1,551 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -accept@2.x.x: - version "2.1.3" - resolved "https://registry.yarnpkg.com/accept/-/accept-2.1.3.tgz#ab0f5bda4c449bbe926aea607b3522562f5acf86" - dependencies: - boom "4.x.x" - hoek "4.x.x" - -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" - dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" - -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - -ammo@2.x.x: - version "2.0.3" - resolved "https://registry.yarnpkg.com/ammo/-/ammo-2.0.3.tgz#914bbcf65b043ed0f58a8a9d0196e250ec51e6a7" - dependencies: - boom "4.x.x" - hoek "4.x.x" - -async@^1.4.0: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - -async@~0.2.6: - version "0.2.10" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" - -b64@3.x.x: - version "3.0.2" - resolved "https://registry.yarnpkg.com/b64/-/b64-3.0.2.tgz#7a9d60466adf7b8de114cbdf651a5fdfcc90894d" - -boom@4.x.x: - version "4.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.2.0.tgz#c1a74174b11fbba223f6162d4fd8851a1b82a536" - dependencies: - hoek "4.x.x" - -buffer-shims@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" - -call@3.x.x: - version "3.0.4" - resolved "https://registry.yarnpkg.com/call/-/call-3.0.4.tgz#e380f2f2a491330aa79085355f8be080877d559e" - dependencies: - boom "4.x.x" - hoek "4.x.x" - -call@4.x.x: - version "4.0.0" - resolved "https://registry.yarnpkg.com/call/-/call-4.0.0.tgz#cd29381a98046a132db26e2628e70bd8321a1ddf" - dependencies: - boom "4.x.x" - hoek "4.x.x" - -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" - -catbox-memory@2.x.x: - version "2.0.4" - resolved "https://registry.yarnpkg.com/catbox-memory/-/catbox-memory-2.0.4.tgz#433e255902caf54233d1286429c8f4df14e822d5" - dependencies: - hoek "4.x.x" - -catbox@7.x.x: - version "7.1.3" - resolved "https://registry.yarnpkg.com/catbox/-/catbox-7.1.3.tgz#9817edec5a921743282addfc9c45ace52847eebb" - dependencies: - boom "4.x.x" - hoek "4.x.x" - joi "10.x.x" - -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" - dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" - -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" - dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" - -content@3.x.x: - version "3.0.3" - resolved "https://registry.yarnpkg.com/content/-/content-3.0.3.tgz#000f8a01371b95c66afe99be9390fa6cb91aa87a" - dependencies: - boom "4.x.x" - -core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -cryptiles@3.x.x: - version "3.1.1" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.1.tgz#86a9203f7367a0e9324bc7555ff0fcf5f81979ee" - dependencies: - boom "4.x.x" - -decamelize@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - -duplexify@^3.1.2: - version "3.5.0" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.0.tgz#1aa773002e1578457e9d9d4a50b0ccaaebcbd604" - dependencies: - end-of-stream "1.0.0" - inherits "^2.0.1" - readable-stream "^2.0.0" - stream-shift "^1.0.0" - -end-of-stream@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.0.0.tgz#d4596e702734a93e40e9af864319eabd99ff2f0e" - dependencies: - once "~1.3.0" - -end-of-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.1.0.tgz#e9353258baa9108965efc41cb0ef8ade2f3cfb07" - dependencies: - once "~1.3.0" - -getconfig@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/getconfig/-/getconfig-3.0.0.tgz#e74ca2581d5ec805f8778e1236569453a0f0ae1d" - -good-console@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/good-console/-/good-console-6.4.0.tgz#7294c9d90c4c9f059a082e180625495966d2ba59" - dependencies: - hoek "4.x.x" - joi "8.1.x" - json-stringify-safe "5.0.x" - moment "2.15.x" - -good@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/good/-/good-7.1.0.tgz#9e05ad24c58a11b71cf5081700f3778db0b22c1c" - dependencies: - hoek "4.x.x" - joi "10.x.x" - oppsy "1.x.x" - pumpify "1.3.x" - -handlebars@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.6.tgz#2ce4484850537f9c97a8026d5399b935c4ed4ed7" - dependencies: - async "^1.4.0" - optimist "^0.6.1" - source-map "^0.4.4" - optionalDependencies: - uglify-js "^2.6" - -hapi@^16.1.0: - version "16.1.0" - resolved "https://registry.yarnpkg.com/hapi/-/hapi-16.1.0.tgz#419dd86347588821eb5a0a5f493bce019802d33b" - dependencies: - accept "2.x.x" - ammo "2.x.x" - boom "4.x.x" - call "4.x.x" - catbox "7.x.x" - catbox-memory "2.x.x" - cryptiles "3.x.x" - heavy "4.x.x" - hoek "4.x.x" - iron "4.x.x" - items "2.x.x" - joi "10.x.x" - mimos "3.x.x" - podium "^1.2.x" - shot "3.x.x" - statehood "5.x.x" - subtext "^4.3.x" - topo "2.x.x" - -heavy@4.x.x: - version "4.0.3" - resolved "https://registry.yarnpkg.com/heavy/-/heavy-4.0.3.tgz#976bba118b011b15fe904aa4f292a168bfc6232f" - dependencies: - boom "4.x.x" - hoek "4.x.x" - joi "10.x.x" - -hoek@4.x.x: - version "4.1.0" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.1.0.tgz#4a4557460f69842ed463aa00628cc26d2683afa7" - -inert@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/inert/-/inert-4.1.0.tgz#e68df9fb0b87d8ad688e3428daaf35d623b64f5d" - dependencies: - ammo "2.x.x" - boom "4.x.x" - hoek "4.x.x" - items "2.x.x" - joi "10.x.x" - lru-cache "4.0.x" - -inherits@^2.0.1, inherits@~2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -iron@4.x.x: - version "4.0.4" - resolved "https://registry.yarnpkg.com/iron/-/iron-4.0.4.tgz#c1f8cc4c91454194ab8920d9247ba882e528061a" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - -is-buffer@^1.0.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isemail@2.x.x: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isemail/-/isemail-2.2.1.tgz#0353d3d9a62951080c262c2aa0a42b8ea8e9e2a6" - -items@2.x.x, items@^2.1.x: - version "2.1.1" - resolved "https://registry.yarnpkg.com/items/-/items-2.1.1.tgz#8bd16d9c83b19529de5aea321acaada78364a198" - -joi@10.x.x: - version "10.2.2" - resolved "https://registry.yarnpkg.com/joi/-/joi-10.2.2.tgz#dc5a792b7b4c6fffa562242a95b55d9d3f077e24" - dependencies: - hoek "4.x.x" - isemail "2.x.x" - items "2.x.x" - topo "2.x.x" - -joi@8.1.x: - version "8.1.1" - resolved "https://registry.yarnpkg.com/joi/-/joi-8.1.1.tgz#2d8b52a5d909d217ed47248577eefe8b1798f48f" - dependencies: - hoek "4.x.x" - isemail "2.x.x" - moment "2.x.x" - topo "2.x.x" - -json-stringify-safe@5.0.x: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - -kind-of@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" - dependencies: - is-buffer "^1.0.2" - -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" - -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - -lru-cache@4.0.x: - version "4.0.2" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.0.2.tgz#1d17679c069cda5d040991a09dbc2c0db377e55e" - dependencies: - pseudomap "^1.0.1" - yallist "^2.0.0" - -mime-db@1.x.x: - version "1.26.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.26.0.tgz#eaffcd0e4fc6935cf8134da246e2e6c35305adff" - -mimos@3.x.x: - version "3.0.3" - resolved "https://registry.yarnpkg.com/mimos/-/mimos-3.0.3.tgz#b9109072ad378c2b72f6a0101c43ddfb2b36641f" - dependencies: - hoek "4.x.x" - mime-db "1.x.x" - -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - -moment@2.15.x, moment@2.x.x: - version "2.15.2" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.15.2.tgz#1bfdedf6a6e345f322fe956d5df5bd08a8ce84dc" - -nes@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/nes/-/nes-6.4.0.tgz#35831781df19cbe5a8014169bbd70887bc5c63d0" - dependencies: - boom "4.x.x" - call "3.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - iron "4.x.x" - items "^2.1.x" - joi "10.x.x" - ws "1.x.x" - -nigel@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/nigel/-/nigel-2.0.2.tgz#93a1866fb0c52d87390aa75e2b161f4b5c75e5b1" - dependencies: - hoek "4.x.x" - vise "2.x.x" - -once@^1.3.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -once@~1.3.0: - version "1.3.3" - resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" - dependencies: - wrappy "1" - -oppsy@1.x.x: - version "1.0.2" - resolved "https://registry.yarnpkg.com/oppsy/-/oppsy-1.0.2.tgz#98014cd6967653a83cfffa554226dc90050baad4" - dependencies: - hoek "4.x.x" - items "2.x.x" - -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - -options@>=0.0.5: - version "0.0.6" - resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f" - -pez@2.x.x: - version "2.1.4" - resolved "https://registry.yarnpkg.com/pez/-/pez-2.1.4.tgz#73f822fa62d599d65c4606f490d54d345191bc7c" - dependencies: - b64 "3.x.x" - boom "4.x.x" - content "3.x.x" - hoek "4.x.x" - nigel "2.x.x" - -podium@^1.2.x: - version "1.2.5" - resolved "https://registry.yarnpkg.com/podium/-/podium-1.2.5.tgz#87c566c2f0365bcf0a1ec7602c4d01948cdd2ad5" - dependencies: - hoek "4.x.x" - items "2.x.x" - joi "10.x.x" - -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" - -pseudomap@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -pump@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.2.tgz#3b3ee6512f94f0e575538c17995f9f16990a5d51" - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -pumpify@1.3.x: - version "1.3.5" - resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.3.5.tgz#1b671c619940abcaeac0ad0e3a3c164be760993b" - dependencies: - duplexify "^3.1.2" - inherits "^2.0.1" - pump "^1.0.0" - -readable-stream@^2.0.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" - dependencies: - buffer-shims "^1.0.0" - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" - util-deprecate "~1.0.1" - -repeat-string@^1.5.2: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" - dependencies: - align-text "^0.1.1" - -shot@3.x.x: - version "3.4.0" - resolved "https://registry.yarnpkg.com/shot/-/shot-3.4.0.tgz#e7125ee72575ae5218349e933636808d790d4b92" - dependencies: - hoek "4.x.x" - joi "10.x.x" - -source-map@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - dependencies: - amdefine ">=0.0.4" - -source-map@~0.5.1: - version "0.5.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" - -statehood@5.x.x: - version "5.0.1" - resolved "https://registry.yarnpkg.com/statehood/-/statehood-5.0.1.tgz#fc13c97b37751c18e70513d2b97e896ac8b73005" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - iron "4.x.x" - items "2.x.x" - joi "10.x.x" - -stream-shift@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" - -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - -subtext@^4.3.x: - version "4.3.0" - resolved "https://registry.yarnpkg.com/subtext/-/subtext-4.3.0.tgz#dfac90492ec35669fd6e00c6e5d938b06d7ccfbb" - dependencies: - boom "4.x.x" - content "3.x.x" - hoek "4.x.x" - pez "2.x.x" - wreck "10.x.x" - -topo@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182" - dependencies: - hoek "4.x.x" - -uglify-js@^2.6: - version "2.7.5" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" - dependencies: - async "~0.2.6" - source-map "~0.5.1" - uglify-to-browserify "~1.0.0" - yargs "~3.10.0" - -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" - -ultron@1.0.x: - version "1.0.2" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -vise@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/vise/-/vise-2.0.2.tgz#6b08e8fb4cb76e3a50cd6dd0ec37338e811a0d39" - dependencies: - hoek "4.x.x" - -vision@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/vision/-/vision-4.1.1.tgz#e1b612b2d2e2f20310a039290fd49d51248f82da" - dependencies: - boom "4.x.x" - hoek "4.x.x" - items "2.x.x" - joi "10.x.x" - -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" - -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -wreck@10.x.x: - version "10.0.0" - resolved "https://registry.yarnpkg.com/wreck/-/wreck-10.0.0.tgz#98ab882f85e16a526332507f101f5a7841162278" - dependencies: - boom "4.x.x" - hoek "4.x.x" - -ws@1.x.x: - version "1.1.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-1.1.2.tgz#8a244fa052401e08c9886cf44a85189e1fd4067f" - dependencies: - options ">=0.0.5" - ultron "1.0.x" - -yallist@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.0.0.tgz#306c543835f09ee1a4cb23b7bce9ab341c91cdd4" - -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" diff --git a/Chapter08/web-server-hardening/http-app/index.js b/Chapter08/web-server-hardening/http-app/index.js deleted file mode 100644 index f6a2a09..0000000 --- a/Chapter08/web-server-hardening/http-app/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const http = require('http') - -const server = http.createServer((req, res) => { - secureHeaders(res) - switch (req.url) { - case '/': return res.end('hello world') - case '/users': return res.end('oh, some users!') - default: return error('404', res) - } -}) - -function secureHeaders (res) { - res.setHeader('X-DNS-Prefetch-Control', 'off') - res.setHeader('X-Frame-Options', 'SAMEORIGIN') - res.setHeader('X-Download-Options', 'noopen') - res.setHeader('X-Content-Type-Options', 'nosniff') - res.setHeader('X-XSS-Protection', '1; mode=block') -} - -function error(code, res) { - res.statusCode = code - res.end(http.STATUS_CODES[code]) -} - -server.listen(3000) \ No newline at end of file diff --git a/Chapter08/web-server-hardening/koa-app/app.js b/Chapter08/web-server-hardening/koa-app/app.js deleted file mode 100644 index 569f219..0000000 --- a/Chapter08/web-server-hardening/koa-app/app.js +++ /dev/null @@ -1,61 +0,0 @@ -const Koa = require('koa') -const helmet = require('koa-helmet') -const app = new Koa() -const router = require('koa-router')() -const views = require('koa-views') -const co = require('co') -const json = require('koa-json') -const onerror = require('koa-onerror') -const bodyparser = require('koa-bodyparser') -const serve = require('koa-static') -const path = require('path') -const log4js = require('koa-log4') -const logger = log4js.getLogger('app') - -const index = require('./routes/index') -const users = require('./routes/users') - -// middlewares -app.use(helmet()) -app.use(bodyparser()) -app.use(json()) -app.use(log4js.koaLogger(log4js.getLogger('http'), { level: 'auto' })) -app.use(serve(path.join(__dirname, 'public'))) - -// handle error -onerror(app) - -// setup view -app.use(views(path.join(__dirname, 'views'), { - extension: 'jade' -})) - -// logger -// app.use(async (ctx, next) => { -// const start = new Date() -// await next() -// const ms = new Date() - start -// logger.info(`${ctx.method} ${ctx.url} - ${ms}ms`) -// }) -app.use(co.wrap(function * (ctx, next) { - const start = new Date() - yield next() - const ms = new Date() - start - logger.info(`${ctx.method} ${ctx.url} - ${ms}ms`) -})) - -// routes definition -router.use('/', index.routes(), index.allowedMethods()) -router.use('/users', users.routes(), users.allowedMethods()) - -// mount root routes -app.use(router.routes()) - .use(router.allowedMethods()) - -// log error -app.on('error', function (err, ctx) { - logger.error(err) - logger.error('server error', err, ctx) -}) - -module.exports = app diff --git a/Chapter08/web-server-hardening/koa-app/bin/www b/Chapter08/web-server-hardening/koa-app/bin/www deleted file mode 100644 index d8f1386..0000000 --- a/Chapter08/web-server-hardening/koa-app/bin/www +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -const app = require('../app') -const http = require('http') -const path = require('path') - -const appDir = path.resolve(__dirname, '..') -const logDir = path.join(appDir, 'logs') -/** - * make a log directory, just in case it isn't there. - */ -try { - require('fs').mkdirSync(logDir) -} catch (e) { - if (e.code !== 'EEXIST') { - console.error('Could not set up log directory, error was: ', e) - process.exit(1) - } -} -const log4js = require('koa-log4') -log4js.configure(path.join(appDir, 'log4js.json'), { cwd: logDir }) -const logger = log4js.getLogger('startup') -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000') -// app.set('port', port) - -/** - * Create HTTP server. - */ - -var server = http.createServer(app.callback()) - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port) -server.on('error', onError) -server.on('listening', onListening) - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort (val) { - var port = parseInt(val, 10) - - if (isNaN(port)) { - // named pipe - return val - } - - if (port >= 0) { - // port number - return port - } - - return false -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError (error) { - if (error.syscall !== 'listen') { - throw error - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - logger.error(bind + ' requires elevated privileges') - process.exit(1) - break - case 'EADDRINUSE': - logger.error(bind + ' is already in use') - process.exit(1) - break - default: - throw error - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening () { - var addr = server.address() - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port - logger.info('Listening on ' + bind) -} diff --git a/Chapter08/web-server-hardening/koa-app/gulpfile.js b/Chapter08/web-server-hardening/koa-app/gulpfile.js deleted file mode 100644 index c54a01a..0000000 --- a/Chapter08/web-server-hardening/koa-app/gulpfile.js +++ /dev/null @@ -1,66 +0,0 @@ -var gulp = require('gulp') -var nodemon = require('gulp-nodemon') -var sourcemaps = require('gulp-sourcemaps') -var concat = require('gulp-concat') -var uglify = require('gulp-uglify') -var cssmin = require('gulp-cssmin') -var del = require('del') -var path = require('path') - -var client = { - js: { - src: 'client/js', - dest: 'public/js' - }, - css: { - src: 'client/css', - dest: 'public/css' - } -} - -gulp.task('default', ['jsmin', 'cssmin', 'start']) - -gulp.task('start', function () { - nodemon({ - script: 'bin/www', - ext: 'js css ejs', - ignore: ['public', 'logs'], - tasks: function (files) { - var tasks = [] - files.forEach(function (file) { - if (path.relative(client.js.src, file).substr(0, 2) !== '..' - && !~tasks.indexOf('jsmin')) { - tasks.push('jsmin') - } - if (path.relative(client.css.src, file).substr(0, 2) !== '..' - && !~tasks.indexOf('cssmin')) { - tasks.push('cssmin') - } - }) - return tasks - } - }) -}) - -gulp.task('cleanjs', function () { - return del([client.js.dest]) -}) - -gulp.task('cleancss', function () { - return del([client.css.dest]) -}) - -gulp.task('jsmin', ['cleanjs'], function () { - return gulp.src(client.js.src + '/**/*.js') - .pipe(sourcemaps.init()) - .pipe(concat('graph.js')) - .pipe(uglify()) - .pipe(gulp.dest(client.js.dest)) -}) - -gulp.task('cssmin', ['cleancss'], function () { - return gulp.src(client.css.src + '/**/*.css') - .pipe(concat('style.css')) - .pipe(cssmin()) - .pipe(gulp.dest(client.css.dest)) -}) diff --git a/Chapter08/web-server-hardening/koa-app/log4js.json b/Chapter08/web-server-hardening/koa-app/log4js.json deleted file mode 100644 index febe3b5..0000000 --- a/Chapter08/web-server-hardening/koa-app/log4js.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "appenders": [ - { - "type": "console" - }, - { - "type": "clustered", - "appenders": [ - { - "type": "dateFile", - "filename": "startup.log", - "pattern": "-yyyy-MM-dd", - "category": "startup" - }, - { - "type": "dateFile", - "filename": "http.log", - "pattern": "-yyyy-MM-dd", - "category": "http" - }, - { - "type": "file", - "filename": "app.log", - "maxLogSize": 10485760, - "numBackups": 5 - }, - { - "type": "logLevelFilter", - "level": "ERROR", - "appender": { - "type": "file", - "filename": "errors.log" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Chapter08/web-server-hardening/koa-app/package.json b/Chapter08/web-server-hardening/koa-app/package.json deleted file mode 100644 index 8b18f50..0000000 --- a/Chapter08/web-server-hardening/koa-app/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "koa-app", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www", - "test": "gulp" - }, - "dependencies": { - "co": "^4.6.0", - "jade": "~1.11.0", - "koa": "^2.0.0", - "koa-bodyparser": "^3.0.0", - "koa-helmet": "^3.1.0", - "koa-json": "^2.0.0", - "koa-log4": "^2.0.1", - "koa-onerror": "^1.2.1", - "koa-router": "^7.0.0", - "koa-static": "^3.0.0", - "koa-views": "^5.0.1" - }, - "devDependencies": { - "del": "^2.2.0", - "gulp": "^3.9.1", - "gulp-concat": "^2.6.0", - "gulp-cssmin": "^0.1.7", - "gulp-nodemon": "^2.0.6", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglify": "^1.5.3" - } -} diff --git a/Chapter08/web-server-hardening/koa-app/public/stylesheets/style.css b/Chapter08/web-server-hardening/koa-app/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter08/web-server-hardening/koa-app/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter08/web-server-hardening/koa-app/routes/index.js b/Chapter08/web-server-hardening/koa-app/routes/index.js deleted file mode 100644 index b0bbe62..0000000 --- a/Chapter08/web-server-hardening/koa-app/routes/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const co = require('co') -const router = require('koa-router')() - -router.get('/', co.wrap(function *(ctx, next) { - ctx.state = { - title: 'Welcome to Koa' - } - yield ctx.render('index', {}) -})) - -// router.get('/', async function (ctx, next) { -// ctx.state = { -// title: 'koa2 title' -// } -// -// await ctx.render('index', { -// }) -// }) -module.exports = router diff --git a/Chapter08/web-server-hardening/koa-app/routes/users.js b/Chapter08/web-server-hardening/koa-app/routes/users.js deleted file mode 100644 index eae6d06..0000000 --- a/Chapter08/web-server-hardening/koa-app/routes/users.js +++ /dev/null @@ -1,7 +0,0 @@ -const router = require('koa-router')() - -router.get('/', function (ctx, next) { - ctx.body = 'this a users response!' -}) - -module.exports = router diff --git a/Chapter08/web-server-hardening/koa-app/views/error.jade b/Chapter08/web-server-hardening/koa-app/views/error.jade deleted file mode 100644 index 51ec12c..0000000 --- a/Chapter08/web-server-hardening/koa-app/views/error.jade +++ /dev/null @@ -1,6 +0,0 @@ -extends layout - -block content - h1= message - h2= error.status - pre #{error.stack} diff --git a/Chapter08/web-server-hardening/koa-app/views/index.jade b/Chapter08/web-server-hardening/koa-app/views/index.jade deleted file mode 100644 index 3d63b9a..0000000 --- a/Chapter08/web-server-hardening/koa-app/views/index.jade +++ /dev/null @@ -1,5 +0,0 @@ -extends layout - -block content - h1= title - p Welcome to #{title} diff --git a/Chapter08/web-server-hardening/koa-app/views/layout.jade b/Chapter08/web-server-hardening/koa-app/views/layout.jade deleted file mode 100644 index 15af079..0000000 --- a/Chapter08/web-server-hardening/koa-app/views/layout.jade +++ /dev/null @@ -1,7 +0,0 @@ -doctype html -html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.css') - body - block content diff --git a/Chapter09/async-opt/calculate-average.js b/Chapter09/async-opt/calculate-average.js deleted file mode 100644 index 302b357..0000000 --- a/Chapter09/async-opt/calculate-average.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const url = 'mongodb://localhost:27017/test'; -var count = 0 -var max = 1000 - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - const average = db.collection('averages') - - collection.find({}).toArray(function (err, data) { - if (err) { throw err } - average.insert({ - value: data.reduce((acc, v) => acc + v, 0) / data.length - }, function (err) { - if (err) { throw err } - db.close() - }) - }) -}) - diff --git a/Chapter09/async-opt/load.js b/Chapter09/async-opt/load.js deleted file mode 100644 index d1c2285..0000000 --- a/Chapter09/async-opt/load.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const url = 'mongodb://localhost:27017/test'; -var count = 0 -var max = 1000 - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - - function insert (err) { - if (err) throw err - - if (count++ === max) { - return db.close() - } - - collection.insert({ - value: Math.random() * 1000000 - }, insert) - } - - insert() -}) - diff --git a/Chapter09/async-opt/package.json b/Chapter09/async-opt/package.json deleted file mode 100644 index fc82b7b..0000000 --- a/Chapter09/async-opt/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "async-opt", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.14.0", - "fastq": "^1.4.1", - "lru-cache": "^4.0.1", - "mongodb": "^2.1.18" - } -} diff --git a/Chapter09/async-opt/server-average.js b/Chapter09/async-opt/server-average.js deleted file mode 100644 index 863a0de..0000000 --- a/Chapter09/async-opt/server-average.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const express = require('express') -const app = express() - -var url = 'mongodb://localhost:27017/test'; - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - app.get('/hello', (req, res) => { - collection.findOne({}, function sum (err, data) { - res.send('' + data.value) - }) - }) - - app.listen(3000) -}) diff --git a/Chapter09/async-opt/server-cache.js b/Chapter09/async-opt/server-cache.js deleted file mode 100644 index 61e0818..0000000 --- a/Chapter09/async-opt/server-cache.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const express = require('express') -const LRU = require('lru-cache') -const fastq = require('fastq') -const app = express() - -var url = 'mongodb://localhost:27017/test'; - -function sum (data) { - var sum = 0 - const l = data.length - for (var i = 0; i < l; i++) { - sum += data[i].value - } - return sum -} - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - const queue = fastq(work) - const cache = LRU({ - maxAge: 1000 * 5 // 5 seconds - }) - - function work (req, done) { - const elem = cache.get('average') - if (elem) { - done(null, elem) - return - } - collection.find({}).toArray(function (err, data) { - if (err) { - done(err) - return - } - const result = sum(data) / data.length - cache.set('average', result) - done(null, result) - }) - } - - app.get('/hello', (req, res) => { - queue.push(req, function (err, result) { - if (err) { - res.send(err.message) - return - } - res.send('' + result) - }) - }) - - app.listen(3000) -}) diff --git a/Chapter09/async-opt/server-no-reduce.js b/Chapter09/async-opt/server-no-reduce.js deleted file mode 100644 index f0f5db3..0000000 --- a/Chapter09/async-opt/server-no-reduce.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const express = require('express') -const app = express() - -var url = 'mongodb://localhost:27017/test' - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - app.get('/hello', (req, res) => { - collection.find({}).toArray(function sum (err, data) { - if (err) { - res.send(err) - return - } - var sum = 0 - const l = data.length - for (var i = 0; i < l; i++) { - sum += data[i].value - } - const result = sum / data.length - res.send('' + result) - }) - }) - - app.listen(3000) -}) \ No newline at end of file diff --git a/Chapter09/async-opt/server-one-sum-fn.js b/Chapter09/async-opt/server-one-sum-fn.js deleted file mode 100644 index d828303..0000000 --- a/Chapter09/async-opt/server-one-sum-fn.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const express = require('express') -const app = express() - -var url = 'mongodb://localhost:27017/test'; - -function sum (data) { - var sum = 0 - const l = data.length - for (var i = 0; i < l; i++) { - sum += data[i].value - } - return sum -} - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - app.get('/hello', (req, res) => { - collection.find({}).toArray(function (err, data) { - if (err) { - res.send(err) - return - } - const result = sum(data) / data.length - res.send('' + result) - }) - }) - - app.listen(3000) -}) diff --git a/Chapter09/async-opt/server.js b/Chapter09/async-opt/server.js deleted file mode 100644 index 26c8f62..0000000 --- a/Chapter09/async-opt/server.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const express = require('express') -const app = express() - -var url = 'mongodb://localhost:27017/test'; - - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - app.get('/hello', (req, res) => { - collection.find({}).toArray(function sum (err, data) { - if (err) { - res.send(err) - return - } - const total = data.reduce((acc, d) => acc + d.value, 0) - const result = total / data.length - res.send('' + result) - }) - }) - - app.listen(3000) -}) diff --git a/Chapter09/async-opt/server2.js b/Chapter09/async-opt/server2.js deleted file mode 100644 index 85b1ec4..0000000 --- a/Chapter09/async-opt/server2.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const MongoClient = require('mongodb').MongoClient -const express = require('express') -const app = express() - -var url = 'mongodb://localhost:27017/test'; - - -MongoClient.connect(url, function(err, db) { - if (err) { throw err } - const collection = db.collection('data') - app.get('/hello', (req, res) => { - var count = 0 - var result = 0 - collection.find({}) - .on('data', function (chunk) { - count++ - result += chunk.value - }) - .on('end', function () { - res.send('' + (result / count)) - }) - }) - - app.listen(3000) -}) diff --git a/Chapter09/bench-http/measuring-post-performance/package.json b/Chapter09/bench-http/measuring-post-performance/package.json deleted file mode 100644 index 3865d17..0000000 --- a/Chapter09/bench-http/measuring-post-performance/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "bench-http", - "version": "0.0.1", - "description": "", - "main": "server.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "UNLICENSED", - "dependencies": { - "body-parser": "^1.15.2", - "express": "^4.13.4" - } -} diff --git a/Chapter09/bench-http/measuring-post-performance/server.js b/Chapter09/bench-http/measuring-post-performance/server.js deleted file mode 100644 index 13bdf4e..0000000 --- a/Chapter09/bench-http/measuring-post-performance/server.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const express = require('express') -const bodyParser = require('body-parser') -const app = express() - -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({extended: false})) - -app.post('/echo', (req, res) => { - res.send(req.body) -}) - -app.listen(3000) diff --git a/Chapter09/bench-http/package.json b/Chapter09/bench-http/package.json deleted file mode 100644 index 13e3c65..0000000 --- a/Chapter09/bench-http/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "bench-http", - "version": "0.0.1", - "description": "", - "main": "server.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "UNLICENSED", - "dependencies": { - "express": "^4.13.4" - } -} diff --git a/Chapter09/bench-http/profiling-for-production/package.json b/Chapter09/bench-http/profiling-for-production/package.json deleted file mode 100644 index e7fb00e..0000000 --- a/Chapter09/bench-http/profiling-for-production/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "bench-http", - "version": "0.0.1", - "description": "", - "main": "server.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "UNLICENSED", - "dependencies": { - "express": "^4.13.4", - "jade": "^1.11.0" - } -} diff --git a/Chapter09/bench-http/profiling-for-production/server.js b/Chapter09/bench-http/profiling-for-production/server.js deleted file mode 100644 index 2a499b2..0000000 --- a/Chapter09/bench-http/profiling-for-production/server.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const express = require('express') -const path = require('path') -const app = express() - -app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'jade'); - -app.get('/hello', (req, res) => { - res.render('hello', { title: 'Express' }); -}) - -app.listen(3000) diff --git a/Chapter09/bench-http/profiling-for-production/views/hello.jade b/Chapter09/bench-http/profiling-for-production/views/hello.jade deleted file mode 100644 index b3dd2e7..0000000 --- a/Chapter09/bench-http/profiling-for-production/views/hello.jade +++ /dev/null @@ -1,7 +0,0 @@ -doctype html -html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.css') - body - h1= title diff --git a/Chapter09/bench-http/server.js b/Chapter09/bench-http/server.js deleted file mode 100644 index ad8c0d6..0000000 --- a/Chapter09/bench-http/server.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' - -const express = require('express') -const app = express() - -app.get('/hello', (req, res) => { - res.send('hello world') -}) - -app.listen(3000) diff --git a/Chapter09/hello-server/package.json b/Chapter09/hello-server/package.json deleted file mode 100644 index 5dfcc8c..0000000 --- a/Chapter09/hello-server/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "hello-server", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "express": "^4.14.0", - "jade": "^1.11.0" - } -} diff --git a/Chapter09/hello-server/server.js b/Chapter09/hello-server/server.js deleted file mode 100644 index 413b1dc..0000000 --- a/Chapter09/hello-server/server.js +++ /dev/null @@ -1,12 +0,0 @@ -const express = require('express') -const path = require('path') -const app = express() - -app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'jade'); - -app.get('/hello', (req, res) => { - res.render('hello', { title: 'Express' }); -}) - -app.listen(3000) diff --git a/Chapter09/hello-server/views/hello.jade b/Chapter09/hello-server/views/hello.jade deleted file mode 100644 index b3dd2e7..0000000 --- a/Chapter09/hello-server/views/hello.jade +++ /dev/null @@ -1,7 +0,0 @@ -doctype html -html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.css') - body - h1= title diff --git a/Chapter09/name-server/climem-enabled/index.js b/Chapter09/name-server/climem-enabled/index.js deleted file mode 100644 index 45485f8..0000000 --- a/Chapter09/name-server/climem-enabled/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const http = require('http') -const starwarsName = require('starwars-names').random -const names = {} - -http.createServer((req, res) => { - res.end(`Your unique name is: ${createName(req)} \n`) -}).listen(8080) - -function createName () { - var result = starwarsName() - if (names[result]) { - result += names[result]++ - } - names[result] = 1 - return result -} \ No newline at end of file diff --git a/Chapter09/name-server/climem-enabled/package.json b/Chapter09/name-server/climem-enabled/package.json deleted file mode 100644 index 4b1d390..0000000 --- a/Chapter09/name-server/climem-enabled/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "name-server", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "starwars-names": "^1.6.0" - }, - "devDependencies": { - "climem": "^1.0.2" - } -} diff --git a/Chapter09/name-server/index.js b/Chapter09/name-server/index.js deleted file mode 100644 index 45485f8..0000000 --- a/Chapter09/name-server/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const http = require('http') -const starwarsName = require('starwars-names').random -const names = {} - -http.createServer((req, res) => { - res.end(`Your unique name is: ${createName(req)} \n`) -}).listen(8080) - -function createName () { - var result = starwarsName() - if (names[result]) { - result += names[result]++ - } - names[result] = 1 - return result -} \ No newline at end of file diff --git a/Chapter09/name-server/non-leaky/index.js b/Chapter09/name-server/non-leaky/index.js deleted file mode 100644 index 62f7c4a..0000000 --- a/Chapter09/name-server/non-leaky/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const http = require('http') -const starwarsName = require('starwars-names').random -const names = {} - -http.createServer((req, res) => { - res.end(`Your unique name is: ${createName(req)} \n`) -}).listen(8080) - -function createName () { - var result = starwarsName() - names[result] = names[result] ? - names[result] + 1 : - 1 - return result + names[result] -} \ No newline at end of file diff --git a/Chapter09/name-server/non-leaky/package.json b/Chapter09/name-server/non-leaky/package.json deleted file mode 100644 index cc9bf3f..0000000 --- a/Chapter09/name-server/non-leaky/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "name-server", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "sillyname": "^0.1.0" - } -} diff --git a/Chapter09/name-server/package.json b/Chapter09/name-server/package.json deleted file mode 100644 index 854c33b..0000000 --- a/Chapter09/name-server/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "name-server", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "David Mark Clements", - "license": "MIT", - "dependencies": { - "starwars-names": "^1.6.0" - } -} diff --git a/Chapter09/placeholder.deleteme b/Chapter09/placeholder.deleteme deleted file mode 100644 index e69de29..0000000 diff --git a/Chapter09/sync-opt/bench.js b/Chapter09/sync-opt/bench.js deleted file mode 100644 index 3b9d63c..0000000 --- a/Chapter09/sync-opt/bench.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const slow = require('./slow') -const noCollection = require('./no-collections') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('slow', function () { - slow(12, numbers) -}) - -suite.add('no-collections', function () { - noCollection(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/checking-optimization-status/bench.js b/Chapter09/sync-opt/checking-optimization-status/bench.js deleted file mode 100644 index 6562c99..0000000 --- a/Chapter09/sync-opt/checking-optimization-status/bench.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const slow = require('./slow') -const noCollection = require('./no-collections') -const noTryCatch = require('./no-try-catch') -const funcStatus = require('./func-status') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('slow', function () { - slow(12, numbers) -}) - -suite.add('no-collections', function () { - noCollection(12, numbers) -}) - -suite.add('no-try-catch', function () { - noTryCatch(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - funcStatus('slow', slow) - funcStatus('noCollection', noCollection) - funcStatus('noTryCatch', noTryCatch) - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/checking-optimization-status/func-status.js b/Chapter09/sync-opt/checking-optimization-status/func-status.js deleted file mode 100644 index 0c66940..0000000 --- a/Chapter09/sync-opt/checking-optimization-status/func-status.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -function printStatus (name, fn) { - switch(%GetOptimizationStatus(fn)) { - case 1: console.log(`${name} function is optimized`); break; - case 2: console.log(`${name} function is not optimized`); break; - case 3: console.log(`${name} function is always optimized`); break; - case 4: console.log(`${name} function is never optimized`); break; - case 6: console.log(`${name} function is maybe deoptimized`); break; - case 7: console.log(`${name} function is optimized by TurboFan`); break; - default: console.log(`${name} function optimization status unknown`); break; - } -} - -module.exports = printStatus diff --git a/Chapter09/sync-opt/checking-optimization-status/no-collections-vs-no-try-catch.js b/Chapter09/sync-opt/checking-optimization-status/no-collections-vs-no-try-catch.js deleted file mode 100644 index 651a1a7..0000000 --- a/Chapter09/sync-opt/checking-optimization-status/no-collections-vs-no-try-catch.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const noCollection = require('./no-collections') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('no-collections', function () { - noCollection(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/checking-optimization-status/no-collections.js b/Chapter09/sync-opt/checking-optimization-status/no-collections.js deleted file mode 100644 index e93243c..0000000 --- a/Chapter09/sync-opt/checking-optimization-status/no-collections.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - var result = 0 - try { - for (var i = 0; i < array.length; i++) { - result += array[i] / num - } - } catch (err) { - // to guard for division by zero - return 0 - } -} - -module.exports = divideByAndSum diff --git a/Chapter09/sync-opt/checking-optimization-status/no-try-catch-bench.js b/Chapter09/sync-opt/checking-optimization-status/no-try-catch-bench.js deleted file mode 100644 index 91ffffd..0000000 --- a/Chapter09/sync-opt/checking-optimization-status/no-try-catch-bench.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const noTryCatch = require('./no-try-catch') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('no-try-catch', function () { - noTryCatch(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/checking-optimization-status/no-try-catch.js b/Chapter09/sync-opt/checking-optimization-status/no-try-catch.js deleted file mode 100644 index 213026b..0000000 --- a/Chapter09/sync-opt/checking-optimization-status/no-try-catch.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - var result = 0 - - if (num === 0) { - return 0 - } - - for (var i = 0; i < array.length; i++) { - result += array[i] / num - } - - return result -} - -module.exports = divideByAndSum diff --git a/Chapter09/sync-opt/checking-optimization-status/slow.js b/Chapter09/sync-opt/checking-optimization-status/slow.js deleted file mode 100644 index f3f38f0..0000000 --- a/Chapter09/sync-opt/checking-optimization-status/slow.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - try { - array.map(function (item) { - return item / num - }).reduce(function (acc, item) { - return acc + item - }, 0) - } catch (err) { - // to guard for division by zero - return 0 - } -} - -module.exports = divideByAndSum diff --git a/Chapter09/sync-opt/function-inlining/bench.js b/Chapter09/sync-opt/function-inlining/bench.js deleted file mode 100644 index 01ec5f7..0000000 --- a/Chapter09/sync-opt/function-inlining/bench.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const slow = require('./slow') -const noCollection = require('./no-collections') -const noTryCatch = require('./no-try-catch') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('slow', function () { - slow(12, numbers) -}) - -suite.add('no-collections', function () { - noCollection(12, numbers) -}) - -suite.add('no-try-catch', function () { - noTryCatch(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/function-inlining/initial-bench.js b/Chapter09/sync-opt/function-inlining/initial-bench.js deleted file mode 100644 index 03021cf..0000000 --- a/Chapter09/sync-opt/function-inlining/initial-bench.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const noCollection = require('./no-collections') -const noTryCatch = require('./no-try-catch') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('no-collections', function () { - noCollection(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/function-inlining/no-collections-vs-no-try-catch.js b/Chapter09/sync-opt/function-inlining/no-collections-vs-no-try-catch.js deleted file mode 100644 index 651a1a7..0000000 --- a/Chapter09/sync-opt/function-inlining/no-collections-vs-no-try-catch.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const noCollection = require('./no-collections') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('no-collections', function () { - noCollection(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/function-inlining/no-collections.js b/Chapter09/sync-opt/function-inlining/no-collections.js deleted file mode 100644 index e93243c..0000000 --- a/Chapter09/sync-opt/function-inlining/no-collections.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - var result = 0 - try { - for (var i = 0; i < array.length; i++) { - result += array[i] / num - } - } catch (err) { - // to guard for division by zero - return 0 - } -} - -module.exports = divideByAndSum diff --git a/Chapter09/sync-opt/function-inlining/no-try-catch-bench.js b/Chapter09/sync-opt/function-inlining/no-try-catch-bench.js deleted file mode 100644 index 91ffffd..0000000 --- a/Chapter09/sync-opt/function-inlining/no-try-catch-bench.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const noTryCatch = require('./no-try-catch') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('no-try-catch', function () { - noTryCatch(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/function-inlining/no-try-catch.js b/Chapter09/sync-opt/function-inlining/no-try-catch.js deleted file mode 100644 index 213026b..0000000 --- a/Chapter09/sync-opt/function-inlining/no-try-catch.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - var result = 0 - - if (num === 0) { - return 0 - } - - for (var i = 0; i < array.length; i++) { - result += array[i] / num - } - - return result -} - -module.exports = divideByAndSum diff --git a/Chapter09/sync-opt/function-inlining/slow.js b/Chapter09/sync-opt/function-inlining/slow.js deleted file mode 100644 index f3f38f0..0000000 --- a/Chapter09/sync-opt/function-inlining/slow.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - try { - array.map(function (item) { - return item / num - }).reduce(function (acc, item) { - return acc + item - }, 0) - } catch (err) { - // to guard for division by zero - return 0 - } -} - -module.exports = divideByAndSum diff --git a/Chapter09/sync-opt/initial-bench.js b/Chapter09/sync-opt/initial-bench.js deleted file mode 100644 index 3801655..0000000 --- a/Chapter09/sync-opt/initial-bench.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict' - -const benchmark = require('benchmark') -const slow = require('./slow') - -const suite = new benchmark.Suite() - -const numbers = [] - -for (let i = 0; i < 1000; i++) { - numbers.push(Math.random() * i) -} - -suite.add('slow', function () { - slow(12, numbers) -}) - -suite.on('complete', print) - -suite.run() - -function print () { - for (var i = 0; i < this.length; i++) { - console.log(this[i].toString()) - } - - console.log('Fastest is', this.filter('fastest').map('name')[0]) -} diff --git a/Chapter09/sync-opt/no-collections.js b/Chapter09/sync-opt/no-collections.js deleted file mode 100644 index e93243c..0000000 --- a/Chapter09/sync-opt/no-collections.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - var result = 0 - try { - for (var i = 0; i < array.length; i++) { - result += array[i] / num - } - } catch (err) { - // to guard for division by zero - return 0 - } -} - -module.exports = divideByAndSum diff --git a/Chapter09/sync-opt/package.json b/Chapter09/sync-opt/package.json deleted file mode 100644 index b0d4c6d..0000000 --- a/Chapter09/sync-opt/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "sync-opt", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "benchmark": "^2.1.0" - } -} diff --git a/Chapter09/sync-opt/slow.js b/Chapter09/sync-opt/slow.js deleted file mode 100644 index f3f38f0..0000000 --- a/Chapter09/sync-opt/slow.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -function divideByAndSum (num, array) { - try { - array.map(function (item) { - return item / num - }).reduce(function (acc, item) { - return acc + item - }, 0) - } catch (err) { - // to guard for division by zero - return 0 - } -} - -module.exports = divideByAndSum diff --git a/Chapter10/adding-a-queue-based-service/micro/adderservice/index.js b/Chapter10/adding-a-queue-based-service/micro/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter10/adding-a-queue-based-service/micro/adderservice/package.json b/Chapter10/adding-a-queue-based-service/micro/adderservice/package.json deleted file mode 100644 index 7cef23a..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/adderservice/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "tap test" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - }, - "devDependencies": { - "tap": "^10.3.1" - } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/adderservice/service.js b/Chapter10/adding-a-queue-based-service/micro/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/adderservice/test/index.js b/Chapter10/adding-a-queue-based-service/micro/adderservice/test/index.js deleted file mode 100644 index 32c45e5..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/adderservice/test/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const {test} = require('tap') -const service = require('../service')() - -test('test add', (t) => { - t.plan(2) - - service.add({first: 1, second: 2}, (err, answer) => { - t.error(err) - t.same(answer, {result: 3}) - }) -}) diff --git a/Chapter10/adding-a-queue-based-service/micro/adderservice/wiring.js b/Chapter10/adding-a-queue-based-service/micro/adderservice/wiring.js deleted file mode 100644 index 0ed018c..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/adderservice/wiring.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter10/adding-a-queue-based-service/micro/auditservice/index.js b/Chapter10/adding-a-queue-based-service/micro/auditservice/index.js deleted file mode 100644 index 40a4677..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/auditservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) diff --git a/Chapter10/adding-a-queue-based-service/micro/auditservice/package.json b/Chapter10/adding-a-queue-based-service/micro/auditservice/package.json deleted file mode 100644 index d93b31e..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/auditservice/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "auditservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "concordant": "^0.2.1", - "mongo": "^0.1.0", - "restify": "^4.3.0" - } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/auditservice/service.js b/Chapter10/adding-a-queue-based-service/micro/auditservice/service.js deleted file mode 100644 index c416e4c..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/auditservice/service.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { dns } = require('concordant')() - -module.exports = service - -function service () { - - var db - - setup() - - function setup () { - const mongo = '_main._tcp.mongo.micro.svc.cluster.local' - - dns.resolve(mongo, (err, locs) => { - if (err) { - console.error(err) - return - } - const { host, port } = locs[0] - const url = `mongodb://${host}:${port}/audit` - MongoClient.connect(url, (err, client) => { - if (err) { - console.log('failed to connect to MongoDB retrying in 100ms') - setTimeout(setup, 100) - return - } - db = client - db.on('close', () => db = null) - }) - }) - } - - function append (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - const data = { - ts: Date.now(), - calc: args.calc, - result: args.calcResult - } - - audit.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, {result: result.toString()}) - }) - } - - function list (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - audit.find({}, {limit: 10}).toArray((err, docs) => { - if (err) { - cb(err) - return - } - cb(null, {list: docs}) - }) - } - - return { append, list } -} - diff --git a/Chapter10/adding-a-queue-based-service/micro/auditservice/wiring.js b/Chapter10/adding-a-queue-based-service/micro/auditservice/wiring.js deleted file mode 100644 index b18dce8..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/auditservice/wiring.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -const restify = require('restify') -const { AUDITSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.use(restify.bodyParser()) - - server.post('/append', (req, res, next) => { - service.append(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(result) - next() - }) - }) - - server.get('/list', (req, res, next) => { - service.list(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(200, result) - next() - }) - }) - - server.listen(AUDITSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter10/adding-a-queue-based-service/micro/eventservice/index.js b/Chapter10/adding-a-queue-based-service/micro/eventservice/index.js deleted file mode 100644 index df3a380..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/eventservice/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() -wiring(service) diff --git a/Chapter10/adding-a-queue-based-service/micro/eventservice/package.json b/Chapter10/adding-a-queue-based-service/micro/eventservice/package.json deleted file mode 100644 index d8a7d4b..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/eventservice/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "eventservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "concordant": "^0.2.1", - "mongo": "^0.1.0", - "redis": "^2.6.5", - "restify": "^4.3.0" - } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/eventservice/service.js b/Chapter10/adding-a-queue-based-service/micro/eventservice/service.js deleted file mode 100644 index 4082d3e..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/eventservice/service.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { dns } = require('concordant')() - -module.exports = service - -function service () { - var db - - setup() - - function setup () { - const mongo = '_main._tcp.mongo.micro.svc.cluster.local' - - dns.resolve(mongo, (err, locs) => { - if (err) { - console.error(err) - return - } - const { host, port } = locs[0] - const url = `mongodb://${host}:${port}/events` - MongoClient.connect(url, (err, client) => { - if (err) { - console.log('failed to connect to MongoDB retrying in 100ms') - setTimeout(setup, 100) - return - } - db = client - db.on('close', () => db = null) - }) - }) - } - - function record (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const events = db.collection('events') - const data = { - ts: Date.now(), - eventType: args.type, - url: args.url - } - events.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, result) - }) - } - - function summary (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const summary = {} - const events = db.collection('events') - events.find({}).toArray( (err, docs) => { - if (err) return cb(err) - - docs.forEach(function (doc) { - if (!(summary[doc.url])) { - summary[doc.url] = 1 - } else { - summary[doc.url]++ - } - }) - cb(null, summary) - }) - } - - return { - record: record, - summary: summary - } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/eventservice/wiring.js b/Chapter10/adding-a-queue-based-service/micro/eventservice/wiring.js deleted file mode 100644 index b04ab35..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/eventservice/wiring.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict' - -const { dns } = require('concordant')() -const redis = require('redis') -const QNAME = 'eventservice' - -module.exports = wiring - -function wiring (service) { - - const endpoint = '_main._tcp.redis.micro.svc.cluster.local' - - dns.resolve(endpoint, (err, locs) => { - if (err) { - console.log(err) - return - } - const { port, host } = locs[0] - pullFromQueue(redis.createClient(port, host)) - }) - - function pullFromQueue (client) { - client.brpop(QNAME, 5, function (err, data) { - if (err) console.error(err) - if (err || !data) { - pullFromQueue(client) - return - } - const msg = JSON.parse(data[1]) - const { action, returnPath } = msg - const cmd = service[action] - if (typeof cmd !== 'function') { - pullFromQueue(client) - return - } - cmd(msg, (err, result) => { - if (err) { - console.error(err) - pullFromQueue(client) - return - } - if (!returnPath) { - pullFromQueue(client) - return - } - client.lpush(returnPath, JSON.stringify(result), (err) => { - if (err) console.error(err) - pullFromQueue(client) - }) - }) - }) - } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/fuge/fuge.yml b/Chapter10/adding-a-queue-based-service/micro/fuge/fuge.yml deleted file mode 100644 index 839ba34..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/fuge/fuge.yml +++ /dev/null @@ -1,45 +0,0 @@ -fuge_global: - run_containers: true - dns_enabled: true - dns_host: 127.0.0.1 - dns_port: 53053 - dns_suffix: svc.cluster.local - dns_namespace: micro - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '**/*.log' -adderservice: - type: node - path: ../adderservice - run: node index.js - ports: - - main=8080 -auditservice: - type: process - path: ../auditservice - run: 'node index.js' - ports: - - main=8081 -eventservice: - type: process - path: ../eventservice - run: 'node index.js' -webapp: - type: process - path: ../webapp - run: npm start - ports: - - http=3000 -mongo: - image: mongo - type: container - ports: - - main=27017:27017 -redis: - image: redis - type: container - ports: - - main=6379:6379 diff --git a/Chapter10/adding-a-queue-based-service/micro/report/env.js b/Chapter10/adding-a-queue-based-service/micro/report/env.js deleted file mode 100644 index a4d26e9..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/report/env.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -// provides environment variable setup for concordant - -const env = { - DNS_NAMESPACE: 'micro', - DNS_SUFFIX: 'svc.cluster.local' -} - -if (process.env.NODE_ENV !== 'production') { - Object.assign(env, { - DNS_HOST: '127.0.0.1', - DNS_PORT: '53053' - }) -} - -Object.assign(process.env, env) \ No newline at end of file diff --git a/Chapter10/adding-a-queue-based-service/micro/report/index.js b/Chapter10/adding-a-queue-based-service/micro/report/index.js deleted file mode 100644 index b65b65a..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/report/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict' -require('./env') -const { dns } = require('concordant')() -const redis = require('redis') -const CliTable = require('cli-table') -const QNAME = 'eventservice' -const RESPONSE_QUEUE = 'summary' -const ENDPOINT = '_main._tcp.redis.micro.svc.cluster.local' - -dns.resolve(ENDPOINT, report) - -function report (err, locs) { - if (err) { return console.log(err) } - const { port, host } = locs[0] - const client = redis.createClient(port, host) - const event = JSON.stringify({ - action: 'summary', - returnPath: RESPONSE_QUEUE - }) - - client.lpush(QNAME, event, (err) => { - if (err) { - console.error(err) - return - } - - client.brpop(RESPONSE_QUEUE, 5, (err, data) => { - if (err) { - console.error(err) - return - } - const summary = JSON.parse(data[1]) - const cols = Object.keys(summary).map((url) => [url, summary[url]]) - const table = new CliTable({ - head: ['url', 'count'], - colWidths: [50, 10] - }) - table.push(...cols) - console.log(table.toString()) - client.quit() - }) - }) -} \ No newline at end of file diff --git a/Chapter10/adding-a-queue-based-service/micro/report/package.json b/Chapter10/adding-a-queue-based-service/micro/report/package.json deleted file mode 100644 index f22e52e..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/report/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "report", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "cli-table": "^0.3.1", - "concordant": "^0.2.1", - "redis": "^2.6.5" - } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/app.js b/Chapter10/adding-a-queue-based-service/micro/webapp/app.js deleted file mode 100644 index eef315b..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/app.js +++ /dev/null @@ -1,52 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') -var eventLogger = require('./lib/event-logger') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') -var audit = require('./routes/audit') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(eventLogger()) -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) -app.use('/audit', audit) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/bin/www b/Chapter10/adding-a-queue-based-service/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/lib/event-logger.js b/Chapter10/adding-a-queue-based-service/micro/webapp/lib/event-logger.js deleted file mode 100644 index 0140d3f..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/lib/event-logger.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' - -const { dns } = require('concordant')() -const redis = require('redis') - -module.exports = eventLogger - -function eventLogger () { - const QNAME = 'eventservice' - var client - - const endpoint = '_main._tcp.redis.micro.svc.cluster.local' - dns.resolve(endpoint, (err, locs) => { - if (err) { - console.error(err) - return - } - const { port, host } = locs[0] - client = redis.createClient(port, host) - }) - - function middleware (req, res, next) { - if (!client) { - console.log('client not ready, waiting 100ms') - setTimeout(middleware, 100, req, res, next) - return - } - const event = { - action: 'record', - type: 'page', - url: `${req.protocol}://${req.get('host')}${req.originalUrl}` - } - client.lpush(QNAME, JSON.stringify(event), (err) => { - if (err) console.error(err) - next() - }) - } - - return middleware -} diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/package.json b/Chapter10/adding-a-queue-based-service/micro/webapp/package.json deleted file mode 100644 index 1c45acf..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "concordant": "^0.2.1", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "mu": "^2.1.2", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/public/stylesheets/style.css b/Chapter10/adding-a-queue-based-service/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/add.js b/Chapter10/adding-a-queue-based-service/micro/webapp/routes/add.js deleted file mode 100644 index 3ab03cc..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/add.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var clients - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', resolve, respond) - -function resolve (req, res, next) { - if (clients) { - next() - return - } - const adderservice = `_main._tcp.adderservice.micro.svc.cluster.local` - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(adderservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const adder = `${host}:${port}` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const audit = `${host}:${port}` - clients = { - adder: restify.createJSONClient({url: `http://${adder}`}), - audit: restify.createJSONClient({url: `http://${audit}`}) - } - next() - }) - }) -} - -function respond (req, res, next) { - const { first, second } = req.body - clients.adder.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - - const { result } = data - clients.audit.post('/append', { - calc: first + '+' + second, - calcResult: result - }, (err) => { - if (err) console.error(err) - }) - - res.render('add', { first, second, result }) - } - ) -} - -module.exports = router diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/audit.js b/Chapter10/adding-a-queue-based-service/micro/webapp/routes/audit.js deleted file mode 100644 index a083eef..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/audit.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var client - -router.get('/', resolve, respond) - -function resolve (req, res, next) { - if (client) { - next() - return - } - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - client = restify.createJSONClient(`http://${host}:${port}`) - }) -} - -function respond (req, res, next) { - client.get('/list', (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - res.render('audit', data) - }) -} - -module.exports = router diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/index.js b/Chapter10/adding-a-queue-based-service/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/users.js b/Chapter10/adding-a-queue-based-service/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/views/add.ejs b/Chapter10/adding-a-queue-based-service/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/views/audit.ejs b/Chapter10/adding-a-queue-based-service/micro/webapp/views/audit.ejs deleted file mode 100644 index dd6d71b..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/views/audit.ejs +++ /dev/null @@ -1,15 +0,0 @@ - - - - Audit - - - -

Calculation History

-
    - <% list.forEach(function (el) { %> -
  • at: <%= new Date(el.ts).toLocaleString() %>, calculated: <%= el.calc %>, result: <%= el.result %>
  • - <% }) %> -
- - \ No newline at end of file diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/views/error.ejs b/Chapter10/adding-a-queue-based-service/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/adding-a-queue-based-service/micro/webapp/views/index.ejs b/Chapter10/adding-a-queue-based-service/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/adding-a-queue-based-service/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter10/consuming-a-service/micro/adderservice/package.json b/Chapter10/consuming-a-service/micro/adderservice/package.json deleted file mode 100644 index dedef88..0000000 --- a/Chapter10/consuming-a-service/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter10/consuming-a-service/micro/adderservice/service.js b/Chapter10/consuming-a-service/micro/adderservice/service.js deleted file mode 100644 index a6d6e74..0000000 --- a/Chapter10/consuming-a-service/micro/adderservice/service.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -const restify = require('restify') - -function respond (req, res, next) { - const result = (parseInt(req.params.first, 10) + - parseInt(req.params.second, 10)).toString() - res.send(result) - next() -} - -const server = restify.createServer() -server.get('/add/:first/:second', respond) - -server.listen(8080, () => { - console.log('%s listening at %s', server.name, server.url) -}) - diff --git a/Chapter10/consuming-a-service/micro/inttest/addtest.js b/Chapter10/consuming-a-service/micro/inttest/addtest.js deleted file mode 100644 index 10698e3..0000000 --- a/Chapter10/consuming-a-service/micro/inttest/addtest.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -const request = require('superagent') -const { test } = require('tap') - -test('add test', (t) => { - t.plan(2) - - request - .post('http://localhost:3000/add/calculate') - .send('first=1') - .send('second=2') - .end((err, res) => { - t.equal(err, null) - t.ok(/result = 3/ig.test(res.text)) - }) -}) - diff --git a/Chapter10/consuming-a-service/micro/inttest/package.json b/Chapter10/consuming-a-service/micro/inttest/package.json deleted file mode 100644 index 672c6b2..0000000 --- a/Chapter10/consuming-a-service/micro/inttest/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "inttest", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "devDependencies": { - "superagent": "^3.5.2", - "tap": "^10.3.1" - } -} diff --git a/Chapter10/consuming-a-service/micro/webapp/app.js b/Chapter10/consuming-a-service/micro/webapp/app.js deleted file mode 100644 index 90f0e7a..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/app.js +++ /dev/null @@ -1,48 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/consuming-a-service/micro/webapp/bin/www b/Chapter10/consuming-a-service/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/consuming-a-service/micro/webapp/package.json b/Chapter10/consuming-a-service/micro/webapp/package.json deleted file mode 100644 index 1c0bcc8..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/consuming-a-service/micro/webapp/public/stylesheets/style.css b/Chapter10/consuming-a-service/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/consuming-a-service/micro/webapp/routes/add.js b/Chapter10/consuming-a-service/micro/webapp/routes/add.js deleted file mode 100644 index 3240051..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/routes/add.js +++ /dev/null @@ -1,26 +0,0 @@ -const { Router } = require('express') -const restify = require('restify') -const router = Router() - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', function (req, res, next) { - const client = restify.createStringClient({ - url: 'http://localhost:8080' - }) - const {first, second} = req.body - client.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, result) => { - if (err) { - next(err) - return - } - res.render('add', { first, second, result }) - } - ) -}) - -module.exports = router diff --git a/Chapter10/consuming-a-service/micro/webapp/routes/index.js b/Chapter10/consuming-a-service/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/consuming-a-service/micro/webapp/routes/users.js b/Chapter10/consuming-a-service/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/consuming-a-service/micro/webapp/views/add.ejs b/Chapter10/consuming-a-service/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/consuming-a-service/micro/webapp/views/error.ejs b/Chapter10/consuming-a-service/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/consuming-a-service/micro/webapp/views/index.ejs b/Chapter10/consuming-a-service/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/consuming-a-service/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/adderservice/package.json b/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/adderservice/package.json deleted file mode 100644 index dedef88..0000000 --- a/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/adderservice/service.js b/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/adderservice/service.js deleted file mode 100644 index b130c44..0000000 --- a/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/adderservice/service.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict' - -const http = require('http') - -const server = http.createServer(respond) - -server.listen(8080, function () { - console.log('listening on port 8080') -}) - -function respond (req, res) { - const [cmd, first, second] = req.url.split('/').slice(1) - const notFound = cmd !== 'add' || - first === undefined || - second === undefined - - if (notFound) { - error(404, res) - return - } - - const result = parseInt(first, 10) + parseInt(second, 10) - res.end(result) -} - -function error(code, res) { - res.statusCode = code - res.end(http.STATUS_CODES[code]) -} - diff --git a/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/curlexample.sh b/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/curlexample.sh deleted file mode 100644 index fb9583e..0000000 --- a/Chapter10/creating-a-simple-RESTful-microservice/micro-core-http/curlexample.sh +++ /dev/null @@ -1 +0,0 @@ -curl http://localhost:8080/add/1/2 diff --git a/Chapter10/creating-a-simple-RESTful-microservice/micro/adderservice/package.json b/Chapter10/creating-a-simple-RESTful-microservice/micro/adderservice/package.json deleted file mode 100644 index dedef88..0000000 --- a/Chapter10/creating-a-simple-RESTful-microservice/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter10/creating-a-simple-RESTful-microservice/micro/adderservice/service.js b/Chapter10/creating-a-simple-RESTful-microservice/micro/adderservice/service.js deleted file mode 100644 index a6d6e74..0000000 --- a/Chapter10/creating-a-simple-RESTful-microservice/micro/adderservice/service.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -const restify = require('restify') - -function respond (req, res, next) { - const result = (parseInt(req.params.first, 10) + - parseInt(req.params.second, 10)).toString() - res.send(result) - next() -} - -const server = restify.createServer() -server.get('/add/:first/:second', respond) - -server.listen(8080, () => { - console.log('%s listening at %s', server.name, server.url) -}) - diff --git a/Chapter10/creating-a-simple-RESTful-microservice/micro/curlexample.sh b/Chapter10/creating-a-simple-RESTful-microservice/micro/curlexample.sh deleted file mode 100644 index fb9583e..0000000 --- a/Chapter10/creating-a-simple-RESTful-microservice/micro/curlexample.sh +++ /dev/null @@ -1 +0,0 @@ -curl http://localhost:8080/add/1/2 diff --git a/Chapter10/service-discovery-with-dns/micro/adderservice/index.js b/Chapter10/service-discovery-with-dns/micro/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter10/service-discovery-with-dns/micro/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter10/service-discovery-with-dns/micro/adderservice/package.json b/Chapter10/service-discovery-with-dns/micro/adderservice/package.json deleted file mode 100644 index 7cef23a..0000000 --- a/Chapter10/service-discovery-with-dns/micro/adderservice/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "tap test" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - }, - "devDependencies": { - "tap": "^10.3.1" - } -} diff --git a/Chapter10/service-discovery-with-dns/micro/adderservice/service.js b/Chapter10/service-discovery-with-dns/micro/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter10/service-discovery-with-dns/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter10/service-discovery-with-dns/micro/adderservice/test/index.js b/Chapter10/service-discovery-with-dns/micro/adderservice/test/index.js deleted file mode 100644 index 32c45e5..0000000 --- a/Chapter10/service-discovery-with-dns/micro/adderservice/test/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const {test} = require('tap') -const service = require('../service')() - -test('test add', (t) => { - t.plan(2) - - service.add({first: 1, second: 2}, (err, answer) => { - t.error(err) - t.same(answer, {result: 3}) - }) -}) diff --git a/Chapter10/service-discovery-with-dns/micro/adderservice/wiring.js b/Chapter10/service-discovery-with-dns/micro/adderservice/wiring.js deleted file mode 100644 index 0ed018c..0000000 --- a/Chapter10/service-discovery-with-dns/micro/adderservice/wiring.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter10/service-discovery-with-dns/micro/auditservice/index.js b/Chapter10/service-discovery-with-dns/micro/auditservice/index.js deleted file mode 100644 index 40a4677..0000000 --- a/Chapter10/service-discovery-with-dns/micro/auditservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) diff --git a/Chapter10/service-discovery-with-dns/micro/auditservice/package.json b/Chapter10/service-discovery-with-dns/micro/auditservice/package.json deleted file mode 100644 index d93b31e..0000000 --- a/Chapter10/service-discovery-with-dns/micro/auditservice/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "auditservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "concordant": "^0.2.1", - "mongo": "^0.1.0", - "restify": "^4.3.0" - } -} diff --git a/Chapter10/service-discovery-with-dns/micro/auditservice/service.js b/Chapter10/service-discovery-with-dns/micro/auditservice/service.js deleted file mode 100644 index c416e4c..0000000 --- a/Chapter10/service-discovery-with-dns/micro/auditservice/service.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { dns } = require('concordant')() - -module.exports = service - -function service () { - - var db - - setup() - - function setup () { - const mongo = '_main._tcp.mongo.micro.svc.cluster.local' - - dns.resolve(mongo, (err, locs) => { - if (err) { - console.error(err) - return - } - const { host, port } = locs[0] - const url = `mongodb://${host}:${port}/audit` - MongoClient.connect(url, (err, client) => { - if (err) { - console.log('failed to connect to MongoDB retrying in 100ms') - setTimeout(setup, 100) - return - } - db = client - db.on('close', () => db = null) - }) - }) - } - - function append (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - const data = { - ts: Date.now(), - calc: args.calc, - result: args.calcResult - } - - audit.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, {result: result.toString()}) - }) - } - - function list (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - audit.find({}, {limit: 10}).toArray((err, docs) => { - if (err) { - cb(err) - return - } - cb(null, {list: docs}) - }) - } - - return { append, list } -} - diff --git a/Chapter10/service-discovery-with-dns/micro/auditservice/wiring.js b/Chapter10/service-discovery-with-dns/micro/auditservice/wiring.js deleted file mode 100644 index b18dce8..0000000 --- a/Chapter10/service-discovery-with-dns/micro/auditservice/wiring.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -const restify = require('restify') -const { AUDITSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.use(restify.bodyParser()) - - server.post('/append', (req, res, next) => { - service.append(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(result) - next() - }) - }) - - server.get('/list', (req, res, next) => { - service.list(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(200, result) - next() - }) - }) - - server.listen(AUDITSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter10/service-discovery-with-dns/micro/fuge/fuge.yml b/Chapter10/service-discovery-with-dns/micro/fuge/fuge.yml deleted file mode 100644 index c263ca7..0000000 --- a/Chapter10/service-discovery-with-dns/micro/fuge/fuge.yml +++ /dev/null @@ -1,35 +0,0 @@ -fuge_global: - dns_enabled: true - dns_host: 127.0.0.1 - dns_port: 53053 - dns_suffix: svc.cluster.local - dns_namespace: micro - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '*.log' -adderservice: - type: process - path: ../adderservice - run: node index.js - ports: - - main=8080 -webapp: - type: process - path: ../webapp - run: npm start - ports: - - main=3000 -auditservice: - type: process - path: ../auditservice - run: 'node index.js' - ports: - - main=8081 -mongo: - image: mongo - type: container - ports: - - main=27017:27017 diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/app.js b/Chapter10/service-discovery-with-dns/micro/webapp/app.js deleted file mode 100644 index ec527f4..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/app.js +++ /dev/null @@ -1,50 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') -var audit = require('./routes/audit') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) -app.use('/audit', audit) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/bin/www b/Chapter10/service-discovery-with-dns/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/package.json b/Chapter10/service-discovery-with-dns/micro/webapp/package.json deleted file mode 100644 index 1c45acf..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "concordant": "^0.2.1", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "mu": "^2.1.2", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/public/stylesheets/style.css b/Chapter10/service-discovery-with-dns/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/routes/add.js b/Chapter10/service-discovery-with-dns/micro/webapp/routes/add.js deleted file mode 100644 index 3ab03cc..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/routes/add.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var clients - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', resolve, respond) - -function resolve (req, res, next) { - if (clients) { - next() - return - } - const adderservice = `_main._tcp.adderservice.micro.svc.cluster.local` - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(adderservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const adder = `${host}:${port}` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const audit = `${host}:${port}` - clients = { - adder: restify.createJSONClient({url: `http://${adder}`}), - audit: restify.createJSONClient({url: `http://${audit}`}) - } - next() - }) - }) -} - -function respond (req, res, next) { - const { first, second } = req.body - clients.adder.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - - const { result } = data - clients.audit.post('/append', { - calc: first + '+' + second, - calcResult: result - }, (err) => { - if (err) console.error(err) - }) - - res.render('add', { first, second, result }) - } - ) -} - -module.exports = router diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/routes/audit.js b/Chapter10/service-discovery-with-dns/micro/webapp/routes/audit.js deleted file mode 100644 index a083eef..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/routes/audit.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var client - -router.get('/', resolve, respond) - -function resolve (req, res, next) { - if (client) { - next() - return - } - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - client = restify.createJSONClient(`http://${host}:${port}`) - }) -} - -function respond (req, res, next) { - client.get('/list', (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - res.render('audit', data) - }) -} - -module.exports = router diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/routes/index.js b/Chapter10/service-discovery-with-dns/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/routes/users.js b/Chapter10/service-discovery-with-dns/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/views/add.ejs b/Chapter10/service-discovery-with-dns/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/views/audit.ejs b/Chapter10/service-discovery-with-dns/micro/webapp/views/audit.ejs deleted file mode 100644 index dd6d71b..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/views/audit.ejs +++ /dev/null @@ -1,15 +0,0 @@ - - - - Audit - - - -

Calculation History

-
    - <% list.forEach(function (el) { %> -
  • at: <%= new Date(el.ts).toLocaleString() %>, calculated: <%= el.calc %>, result: <%= el.result %>
  • - <% }) %> -
- - \ No newline at end of file diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/views/error.ejs b/Chapter10/service-discovery-with-dns/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/service-discovery-with-dns/micro/webapp/views/index.ejs b/Chapter10/service-discovery-with-dns/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/service-discovery-with-dns/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/adderservice/package.json b/Chapter10/setting-up-a-development-environment/micro-lil-pids/adderservice/package.json deleted file mode 100644 index dedef88..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/adderservice/service.js b/Chapter10/setting-up-a-development-environment/micro-lil-pids/adderservice/service.js deleted file mode 100644 index 5131b53..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/adderservice/service.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' - -const restify = require('restify') - -function respond (req, res, next) { - const result = (parseInt(req.params.first, 10) + - parseInt(req.params.second, 10)).toString() - console.log('adding numbers!') - res.send(result) - next() -} - -const server = restify.createServer() -server.get('/add/:first/:second', respond) - -server.listen(8080, () => { - console.log('%s listening at %s', server.name, server.url) -}) - diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/services b/Chapter10/setting-up-a-development-environment/micro-lil-pids/services deleted file mode 100644 index 8d17b4a..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/services +++ /dev/null @@ -1,2 +0,0 @@ -cd webapp && npm start -cd adderservice && node service diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/app.js b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/app.js deleted file mode 100644 index 90f0e7a..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/app.js +++ /dev/null @@ -1,48 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/bin/www b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/package.json b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/package.json deleted file mode 100644 index 1c0bcc8..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/public/stylesheets/style.css b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/add.js b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/add.js deleted file mode 100644 index e1c2ebc..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/add.js +++ /dev/null @@ -1,26 +0,0 @@ -const { Router } = require('express') -const restify = require('restify') -const router = Router() - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', function (req, res, next) { - const client = restify.createStringClient({ - url: 'http://localhost:8080' - }) - const {first, second} = req.body - client.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, result) => { - if (err) { - next(err) - return - } - res.render('add', { first, second, result }) - } - ) -}) - -module.exports = router diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/index.js b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/users.js b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/add.ejs b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/error.ejs b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/index.ejs b/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/setting-up-a-development-environment/micro-lil-pids/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter10/setting-up-a-development-environment/micro/adderservice/package.json b/Chapter10/setting-up-a-development-environment/micro/adderservice/package.json deleted file mode 100644 index dedef88..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter10/setting-up-a-development-environment/micro/adderservice/service.js b/Chapter10/setting-up-a-development-environment/micro/adderservice/service.js deleted file mode 100644 index 5131b53..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/adderservice/service.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' - -const restify = require('restify') - -function respond (req, res, next) { - const result = (parseInt(req.params.first, 10) + - parseInt(req.params.second, 10)).toString() - console.log('adding numbers!') - res.send(result) - next() -} - -const server = restify.createServer() -server.get('/add/:first/:second', respond) - -server.listen(8080, () => { - console.log('%s listening at %s', server.name, server.url) -}) - diff --git a/Chapter10/setting-up-a-development-environment/micro/fuge/fuge.yml b/Chapter10/setting-up-a-development-environment/micro/fuge/fuge.yml deleted file mode 100644 index 1868afd..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/fuge/fuge.yml +++ /dev/null @@ -1,19 +0,0 @@ -fuge_global: - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '*.log' -adderservice: - type: process - path: ../adderservice - run: 'node service.js' - ports: - - main=8080 -webapp: - type: process - path: ../webapp - run: 'npm start' - ports: - - main=3000 diff --git a/Chapter10/setting-up-a-development-environment/micro/fuge/fuge2.yml b/Chapter10/setting-up-a-development-environment/micro/fuge/fuge2.yml deleted file mode 100644 index 642a1ba..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/fuge/fuge2.yml +++ /dev/null @@ -1,19 +0,0 @@ -fuge_global: - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '*.log' -adderservice: - type: node - path: ../adderservice - run: 'node service.js' - ports: - - main=8080 -webapp: - type: process - path: ../webapp - run: 'npm start' - ports: - - main=3000 diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/app.js b/Chapter10/setting-up-a-development-environment/micro/webapp/app.js deleted file mode 100644 index 90f0e7a..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/app.js +++ /dev/null @@ -1,48 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/bin/www b/Chapter10/setting-up-a-development-environment/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/package.json b/Chapter10/setting-up-a-development-environment/micro/webapp/package.json deleted file mode 100644 index 1c0bcc8..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/public/stylesheets/style.css b/Chapter10/setting-up-a-development-environment/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/routes/add.js b/Chapter10/setting-up-a-development-environment/micro/webapp/routes/add.js deleted file mode 100644 index e1c2ebc..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/routes/add.js +++ /dev/null @@ -1,26 +0,0 @@ -const { Router } = require('express') -const restify = require('restify') -const router = Router() - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', function (req, res, next) { - const client = restify.createStringClient({ - url: 'http://localhost:8080' - }) - const {first, second} = req.body - client.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, result) => { - if (err) { - next(err) - return - } - res.render('add', { first, second, result }) - } - ) -}) - -module.exports = router diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/routes/index.js b/Chapter10/setting-up-a-development-environment/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/routes/users.js b/Chapter10/setting-up-a-development-environment/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/views/add.ejs b/Chapter10/setting-up-a-development-environment/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/views/error.ejs b/Chapter10/setting-up-a-development-environment/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/setting-up-a-development-environment/micro/webapp/views/index.ejs b/Chapter10/setting-up-a-development-environment/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/setting-up-a-development-environment/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/index.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/package.json b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/package.json deleted file mode 100644 index e2d4f59..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "bloomrun": "^3.0.4", - "net-object-stream": "^2.0.0", - "pump": "^1.0.2", - "through2": "^2.0.3" - }, - "devDependencies": { - "tap": "^10.3.1" - } -} diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/service.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/test/test.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/test/test.js deleted file mode 100644 index 3b775c3..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/test/test.js +++ /dev/null @@ -1,12 +0,0 @@ -var test = require('tap').test -var service = require('../service')() - -test('test add', function (t) { - t.plan(2) - - service.add({first: 1, second: 2}, function (err, result) { - t.equal(err, null) - t.equal(result, 3) - }) -}) - diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/wiring.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/wiring.js deleted file mode 100644 index 6411252..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/adderservice/wiring.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict' - -const net = require('net') -const nos = require('net-object-stream') -const through = require('through2') -const pump = require('pump') -const bloomrun = require('bloomrun') - -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const patterns = createPatternRoutes(service) - const matcher = createMatcherStream(patterns) - - const server = net.createServer((socket) => { - socket = nos(socket) - pump(socket, matcher, socket, failure) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('server listening at', ADDERSERVICE_SERVICE_PORT) - }) -} - -function createPatternRoutes (service) { - const patterns = bloomrun() - - patterns.add({role: 'adder', cmd: 'add'}, service.add) - - return patterns -} - -function createMatcherStream (patterns) { - return through.obj((object, enc, cb) => { - const match = patterns.lookup(object) - if (match === null) { - cb() - return - } - match(object, (err, data) => { - if (err) { - cb(null, {status: 'error', err: err}) - return - } - cb(null, data) - }) - }) -} - -function failure (err) { - if (err) console.error('Server error', err) - else console.error('Stream pipeline ended') -} \ No newline at end of file diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/fuge/fuge.yml b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/fuge/fuge.yml deleted file mode 100644 index 94093bd..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/fuge/fuge.yml +++ /dev/null @@ -1,19 +0,0 @@ -fuge_global: - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '*.log' -adderservice: - type: process - path: ../adderservice - run: node index.js - ports: - - main=8080 -webapp: - type: process - path: ../webapp - run: npm start - ports: - - main=3000 diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/app.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/app.js deleted file mode 100644 index 90f0e7a..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/app.js +++ /dev/null @@ -1,48 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/bin/www b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/package.json b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/package.json deleted file mode 100644 index ce66c6a..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "mu": "^2.1.2", - "net-object-stream": "^2.0.0", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/public/stylesheets/style.css b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/add.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/add.js deleted file mode 100644 index d96af85..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/add.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const net = require('net') -const nos = require('net-object-stream') -const router = Router() - -const { - ADDERSERVICE_SERVICE_HOST, - ADDERSERVICE_SERVICE_PORT -} = process.env - -function createClient (ns, opts) { - return createClient[ns] || (createClient[ns] = nos(net.connect(opts))) -} - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', function (req, res, next) { - const client = createClient('calculate', { - host: ADDERSERVICE_SERVICE_HOST, - port: ADDERSERVICE_SERVICE_PORT - }) - - const role = 'adder' - const cmd = 'add' - const { first, second } = req.body - client.once('data', (data) => { - const { result } = data - res.render('add', { first, second, result }) - }) - client.write({role, cmd, first, second}) -}) - -module.exports = router diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/index.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/users.js b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/add.ejs b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/error.ejs b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/index.ejs b/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro-pattern-routing/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter10/standardizing-service-boilerplate/micro/adderservice/index.js b/Chapter10/standardizing-service-boilerplate/micro/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter10/standardizing-service-boilerplate/micro/adderservice/package.json b/Chapter10/standardizing-service-boilerplate/micro/adderservice/package.json deleted file mode 100644 index 7cef23a..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/adderservice/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "tap test" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - }, - "devDependencies": { - "tap": "^10.3.1" - } -} diff --git a/Chapter10/standardizing-service-boilerplate/micro/adderservice/service.js b/Chapter10/standardizing-service-boilerplate/micro/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter10/standardizing-service-boilerplate/micro/adderservice/test/index.js b/Chapter10/standardizing-service-boilerplate/micro/adderservice/test/index.js deleted file mode 100644 index 32c45e5..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/adderservice/test/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const {test} = require('tap') -const service = require('../service')() - -test('test add', (t) => { - t.plan(2) - - service.add({first: 1, second: 2}, (err, answer) => { - t.error(err) - t.same(answer, {result: 3}) - }) -}) diff --git a/Chapter10/standardizing-service-boilerplate/micro/adderservice/wiring.js b/Chapter10/standardizing-service-boilerplate/micro/adderservice/wiring.js deleted file mode 100644 index 0ed018c..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/adderservice/wiring.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter10/standardizing-service-boilerplate/micro/fuge/fuge.yml b/Chapter10/standardizing-service-boilerplate/micro/fuge/fuge.yml deleted file mode 100644 index 94093bd..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/fuge/fuge.yml +++ /dev/null @@ -1,19 +0,0 @@ -fuge_global: - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '*.log' -adderservice: - type: process - path: ../adderservice - run: node index.js - ports: - - main=8080 -webapp: - type: process - path: ../webapp - run: npm start - ports: - - main=3000 diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/app.js b/Chapter10/standardizing-service-boilerplate/micro/webapp/app.js deleted file mode 100644 index 90f0e7a..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/app.js +++ /dev/null @@ -1,48 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/bin/www b/Chapter10/standardizing-service-boilerplate/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/package.json b/Chapter10/standardizing-service-boilerplate/micro/webapp/package.json deleted file mode 100644 index c0d6ed3..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "mu": "^2.1.2", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/public/stylesheets/style.css b/Chapter10/standardizing-service-boilerplate/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/add.js b/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/add.js deleted file mode 100644 index 2074c32..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/add.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const router = Router() - -const { - ADDERSERVICE_SERVICE_HOST, - ADDERSERVICE_SERVICE_PORT -} = process.env - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', function (req, res, next) { - const client = restify.createJSONClient({ - url: `http://${ADDERSERVICE_SERVICE_HOST}:${ADDERSERVICE_SERVICE_PORT}` - }) - const { first, second } = req.body - client.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - const { result } = data - res.render('add', { first, second, result }) - } - ) -}) - -module.exports = router diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/index.js b/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/users.js b/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/views/add.ejs b/Chapter10/standardizing-service-boilerplate/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/views/error.ejs b/Chapter10/standardizing-service-boilerplate/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/standardizing-service-boilerplate/micro/webapp/views/index.ejs b/Chapter10/standardizing-service-boilerplate/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/standardizing-service-boilerplate/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter10/using-containerized-infrastructure/micro/adderservice/index.js b/Chapter10/using-containerized-infrastructure/micro/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter10/using-containerized-infrastructure/micro/adderservice/package.json b/Chapter10/using-containerized-infrastructure/micro/adderservice/package.json deleted file mode 100644 index 7cef23a..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/adderservice/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "tap test" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - }, - "devDependencies": { - "tap": "^10.3.1" - } -} diff --git a/Chapter10/using-containerized-infrastructure/micro/adderservice/service.js b/Chapter10/using-containerized-infrastructure/micro/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter10/using-containerized-infrastructure/micro/adderservice/test/index.js b/Chapter10/using-containerized-infrastructure/micro/adderservice/test/index.js deleted file mode 100644 index 32c45e5..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/adderservice/test/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -const {test} = require('tap') -const service = require('../service')() - -test('test add', (t) => { - t.plan(2) - - service.add({first: 1, second: 2}, (err, answer) => { - t.error(err) - t.same(answer, {result: 3}) - }) -}) diff --git a/Chapter10/using-containerized-infrastructure/micro/adderservice/wiring.js b/Chapter10/using-containerized-infrastructure/micro/adderservice/wiring.js deleted file mode 100644 index 0ed018c..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/adderservice/wiring.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter10/using-containerized-infrastructure/micro/auditservice/index.js b/Chapter10/using-containerized-infrastructure/micro/auditservice/index.js deleted file mode 100644 index 40a4677..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/auditservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) diff --git a/Chapter10/using-containerized-infrastructure/micro/auditservice/package.json b/Chapter10/using-containerized-infrastructure/micro/auditservice/package.json deleted file mode 100644 index 0231ff1..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/auditservice/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "auditservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "mongo": "^0.1.0", - "restify": "^4.3.0" - } -} diff --git a/Chapter10/using-containerized-infrastructure/micro/auditservice/service.js b/Chapter10/using-containerized-infrastructure/micro/auditservice/service.js deleted file mode 100644 index f6592f2..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/auditservice/service.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { - MONGO_SERVICE_HOST, - MONGO_SERVICE_PORT -} = process.env -const url = `mongodb://${MONGO_SERVICE_HOST}:${MONGO_SERVICE_PORT}/audit` - -module.exports = service - -function service () { - function append (args, cb) { - MongoClient.connect(url, (err, db) => { - if (err) { - cb(err) - return - } - - const audit = db.collection('audit') - const data = { - ts: Date.now(), - calc: args.calc, - result: args.calcResult - } - - audit.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, {result: result.toString()}) - db.close() - }) - }) - } - - function list (args, cb) { - MongoClient.connect(url, (err, db) => { - if (err) { - cb(err) - return - } - const audit = db.collection('audit') - audit.find({}, {limit: 10}).toArray((err, docs) => { - if (err) { - cb(err) - return - } - cb(null, {list: docs}) - db.close() - }) - }) - } - - return { append, list } -} - diff --git a/Chapter10/using-containerized-infrastructure/micro/auditservice/wiring.js b/Chapter10/using-containerized-infrastructure/micro/auditservice/wiring.js deleted file mode 100644 index b18dce8..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/auditservice/wiring.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -const restify = require('restify') -const { AUDITSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.use(restify.bodyParser()) - - server.post('/append', (req, res, next) => { - service.append(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(result) - next() - }) - }) - - server.get('/list', (req, res, next) => { - service.list(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(200, result) - next() - }) - }) - - server.listen(AUDITSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter10/using-containerized-infrastructure/micro/fuge/fuge.yml b/Chapter10/using-containerized-infrastructure/micro/fuge/fuge.yml deleted file mode 100644 index c3311d4..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/fuge/fuge.yml +++ /dev/null @@ -1,30 +0,0 @@ -fuge_global: - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '*.log' -adderservice: - type: process - path: ../adderservice - run: node index.js - ports: - - main=8080 -webapp: - type: process - path: ../webapp - run: npm start - ports: - - main=3000 -auditservice: - type: process - path: ../auditservice - run: 'node index.js' - ports: - - main=8081 -mongo: - image: mongo - type: container - ports: - - main=27017:27017 diff --git a/Chapter10/using-containerized-infrastructure/micro/fuge/fuge2.yml b/Chapter10/using-containerized-infrastructure/micro/fuge/fuge2.yml deleted file mode 100644 index e5c2a4b..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/fuge/fuge2.yml +++ /dev/null @@ -1,31 +0,0 @@ -fuge_global: - run_containers: false - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '*.log' -adderservice: - type: process - path: ../adderservice - run: node index.js - ports: - - main=8080 -webapp: - type: process - path: ../webapp - run: npm start - ports: - - main=3000 -auditservice: - type: process - path: ../auditservice - run: 'node index.js' - ports: - - main=8081 -mongo: - image: mongo - type: container - ports: - - main=27017:27017 diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/app.js b/Chapter10/using-containerized-infrastructure/micro/webapp/app.js deleted file mode 100644 index ec527f4..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/app.js +++ /dev/null @@ -1,50 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') -var audit = require('./routes/audit') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) -app.use('/audit', audit) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/bin/www b/Chapter10/using-containerized-infrastructure/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/package.json b/Chapter10/using-containerized-infrastructure/micro/webapp/package.json deleted file mode 100644 index c0d6ed3..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "mu": "^2.1.2", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/public/stylesheets/style.css b/Chapter10/using-containerized-infrastructure/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/add.js b/Chapter10/using-containerized-infrastructure/micro/webapp/routes/add.js deleted file mode 100644 index 2744945..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/add.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const router = Router() - -const { - ADDERSERVICE_SERVICE_HOST, - ADDERSERVICE_SERVICE_PORT, - AUDITSERVICE_SERVICE_HOST, - AUDITSERVICE_SERVICE_PORT, -} = process.env - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', function (req, res, next) { - const clients = { - adder: restify.createJSONClient({ - url: `http://${ADDERSERVICE_SERVICE_HOST}:${ADDERSERVICE_SERVICE_PORT}` - }), - audit: restify.createJSONClient({ - url: `http://${AUDITSERVICE_SERVICE_HOST}:${AUDITSERVICE_SERVICE_PORT}` - }) - } - const { first, second } = req.body - clients.adder.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - - const { result } = data - clients.audit.post('/append', { - calc: first + '+' + second, - calcResult: result - }, (err) => { - if (err) console.error(err) - }) - - res.render('add', { first, second, result }) - } - ) -}) - -module.exports = router diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/audit.js b/Chapter10/using-containerized-infrastructure/micro/webapp/routes/audit.js deleted file mode 100644 index 1385f8f..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/audit.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const router = Router() - -const { - AUDITSERVICE_SERVICE_HOST, - AUDITSERVICE_SERVICE_PORT -} = process.env - -router.get('/', (req, res, next) => { - const url = `http://${AUDITSERVICE_SERVICE_HOST}:${AUDITSERVICE_SERVICE_PORT}` - const client = restify.createJsonClient({ url }) - - client.get('/list', (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - res.render('audit', data) - }) -}) - -module.exports = router diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/index.js b/Chapter10/using-containerized-infrastructure/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/users.js b/Chapter10/using-containerized-infrastructure/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/views/add.ejs b/Chapter10/using-containerized-infrastructure/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/views/audit.ejs b/Chapter10/using-containerized-infrastructure/micro/webapp/views/audit.ejs deleted file mode 100644 index dd6d71b..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/views/audit.ejs +++ /dev/null @@ -1,15 +0,0 @@ - - - - Audit - - - -

Calculation History

-
    - <% list.forEach(function (el) { %> -
  • at: <%= new Date(el.ts).toLocaleString() %>, calculated: <%= el.calc %>, result: <%= el.result %>
  • - <% }) %> -
- - \ No newline at end of file diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/views/error.ejs b/Chapter10/using-containerized-infrastructure/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter10/using-containerized-infrastructure/micro/webapp/views/index.ejs b/Chapter10/using-containerized-infrastructure/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter10/using-containerized-infrastructure/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter11/building-a-single-container/micro/adderservice/.dockerignore b/Chapter11/building-a-single-container/micro/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/building-a-single-container/micro/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/building-a-single-container/micro/adderservice/Dockerfile b/Chapter11/building-a-single-container/micro/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/building-a-single-container/micro/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/building-a-single-container/micro/adderservice/index.js b/Chapter11/building-a-single-container/micro/adderservice/index.js deleted file mode 100644 index 753a4ce..0000000 --- a/Chapter11/building-a-single-container/micro/adderservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) \ No newline at end of file diff --git a/Chapter11/building-a-single-container/micro/adderservice/package.json b/Chapter11/building-a-single-container/micro/adderservice/package.json deleted file mode 100644 index 595a5b0..0000000 --- a/Chapter11/building-a-single-container/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adder-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter11/building-a-single-container/micro/adderservice/service.js b/Chapter11/building-a-single-container/micro/adderservice/service.js deleted file mode 100644 index af95084..0000000 --- a/Chapter11/building-a-single-container/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} \ No newline at end of file diff --git a/Chapter11/building-a-single-container/micro/adderservice/wiring.js b/Chapter11/building-a-single-container/micro/adderservice/wiring.js deleted file mode 100644 index 0e81c6c..0000000 --- a/Chapter11/building-a-single-container/micro/adderservice/wiring.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} \ No newline at end of file diff --git a/Chapter11/building-a-single-container/test.sh b/Chapter11/building-a-single-container/test.sh deleted file mode 100644 index 5086478..0000000 --- a/Chapter11/building-a-single-container/test.sh +++ /dev/null @@ -1 +0,0 @@ -curl http://localhost:8080/add/2/3 diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/.dockerignore b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/Dockerfile b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/Jenkinsfile b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/Jenkinsfile deleted file mode 100644 index 8ea826e..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('Build') { - steps { - sh 'source ~/.bashrc && cd adderservice && npm install' - } - } - stage('Test'){ - steps { - sh 'source ~/.bashrc && cd adderservice && npm test' - } - } - stage('Container'){ - steps { - sh 'source ~/.bashrc && cd adderservice && sh build.sh container' - } - } - stage('Deploy'){ - steps { - sh 'source ~/.bashrc && cd adderservice && sh build.sh deploy' - } - } - } -} - diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/build.sh b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/build.sh deleted file mode 100644 index 7da8cb6..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ~/.bashrc - -GITSHA=$(git rev-parse --short HEAD) - -case "$1" in - container) - sudo -u pelger docker build -t adderservice:$GITSHA . - sudo -u pelger docker tag adderservice:$GITSHA pelger/adderservice:$GITSHA - sudo -i -u pelger docker push pelger/adderservice:$GITSHA - ;; - deploy) - sed -e s/_NAME_/adderservice/ -e s/_PORT_/8080/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/adderservice/ -e s/_PORT_/8080/ -e s/_IMAGE_/pelger\\/adderservice:$GITSHA/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/index.js b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/package.json b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/package.json deleted file mode 100644 index 7cef23a..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "adderservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "tap test" - }, - "keywords": [], - "author": "Peter Elger", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - }, - "devDependencies": { - "tap": "^10.3.1" - } -} diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/service.js b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/wiring.js b/Chapter11/creating-a-deployment-pipeline/micro/adderservice/wiring.js deleted file mode 100644 index 0ed018c..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/adderservice/wiring.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter11/creating-a-deployment-pipeline/micro/deployment/deployment-template.yml b/Chapter11/creating-a-deployment-pipeline/micro/deployment/deployment-template.yml deleted file mode 100644 index 42ee070..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/deployment/deployment-template.yml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: _NAME_ -spec: - replicas: 1 - template: - metadata: - labels: - run: _NAME_ - spec: - containers: - - name: _NAME_ - image: _IMAGE_ - ports: - - containerPort: _PORT_ - diff --git a/Chapter11/creating-a-deployment-pipeline/micro/deployment/namespace.yml b/Chapter11/creating-a-deployment-pipeline/micro/deployment/namespace.yml deleted file mode 100644 index 1351cbb..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/deployment/namespace.yml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: micro - labels: - name: micro diff --git a/Chapter11/creating-a-deployment-pipeline/micro/deployment/service-template.yml b/Chapter11/creating-a-deployment-pipeline/micro/deployment/service-template.yml deleted file mode 100644 index 11010f6..0000000 --- a/Chapter11/creating-a-deployment-pipeline/micro/deployment/service-template.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: _NAME_ - labels: - run: _NAME_ -spec: - ports: - - port: _PORT_ - name: main - protocol: TCP - targetPort: _PORT_ - selector: - run: _NAME_ - type: NodePort - diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/.dockerignore b/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/Dockerfile b/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/index.js b/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/index.js deleted file mode 100644 index 753a4ce..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) \ No newline at end of file diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/package.json b/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/package.json deleted file mode 100644 index 595a5b0..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adder-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/service.js b/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/service.js deleted file mode 100644 index af95084..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} \ No newline at end of file diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/wiring.js b/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/wiring.js deleted file mode 100644 index 0e81c6c..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/adderservice/wiring.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} \ No newline at end of file diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/adderservice-dep.yml b/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/adderservice-dep.yml deleted file mode 100644 index 65b998f..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/adderservice-dep.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: adderservice -spec: - replicas: 1 - template: - metadata: - labels: - run: adderservice - spec: - containers: - - name: adderservice - image: pelger/adderservice - ports: - - containerPort: 8080 diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/adderservice-svc.yml b/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/adderservice-svc.yml deleted file mode 100644 index 5327532..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/adderservice-svc.yml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: adderservice - labels: - run: adderservice -spec: - ports: - - port: 8080 - name: main - protocol: TCP - targetPort: 8080 - selector: - run: adderservice - type: NodePort diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/namespace.yml b/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/namespace.yml deleted file mode 100644 index 1351cbb..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro/deployment/namespace.yml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: micro - labels: - name: micro diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/.dockerignore b/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/Dockerfile b/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/index.js b/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/index.js deleted file mode 100644 index 753a4ce..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) \ No newline at end of file diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/package.json b/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/package.json deleted file mode 100644 index 595a5b0..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adder-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/service.js b/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/service.js deleted file mode 100644 index d7510a9..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/service.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - console.log(`add called: ${first} ${second}`) - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} \ No newline at end of file diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/wiring.js b/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/wiring.js deleted file mode 100644 index 0e81c6c..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/adderservice/wiring.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} \ No newline at end of file diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/adderservice-dep.yml b/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/adderservice-dep.yml deleted file mode 100644 index 540d543..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/adderservice-dep.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: adderservice -spec: - replicas: 1 - template: - metadata: - labels: - run: adderservice - spec: - containers: - - name: adderservice - image: pelger/adderservice:2 - ports: - - containerPort: 8080 diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/adderservice-svc.yml b/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/adderservice-svc.yml deleted file mode 100644 index 5327532..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/adderservice-svc.yml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: adderservice - labels: - run: adderservice -spec: - ports: - - port: 8080 - name: main - protocol: TCP - targetPort: 8080 - selector: - run: adderservice - type: NodePort diff --git a/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/namespace.yml b/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/namespace.yml deleted file mode 100644 index 1351cbb..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/micro2/deployment/namespace.yml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: micro - labels: - name: micro diff --git a/Chapter11/deploying-a-container-to-kubernetes/test.sh b/Chapter11/deploying-a-container-to-kubernetes/test.sh deleted file mode 100644 index 5086478..0000000 --- a/Chapter11/deploying-a-container-to-kubernetes/test.sh +++ /dev/null @@ -1 +0,0 @@ -curl http://localhost:8080/add/2/3 diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/.dockerignore b/Chapter11/deploying-a-full-system/micro/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/Dockerfile b/Chapter11/deploying-a-full-system/micro/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/Jenkinsfile b/Chapter11/deploying-a-full-system/micro/adderservice/Jenkinsfile deleted file mode 100644 index 8ea826e..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('Build') { - steps { - sh 'source ~/.bashrc && cd adderservice && npm install' - } - } - stage('Test'){ - steps { - sh 'source ~/.bashrc && cd adderservice && npm test' - } - } - stage('Container'){ - steps { - sh 'source ~/.bashrc && cd adderservice && sh build.sh container' - } - } - stage('Deploy'){ - steps { - sh 'source ~/.bashrc && cd adderservice && sh build.sh deploy' - } - } - } -} - diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/build.sh b/Chapter11/deploying-a-full-system/micro/adderservice/build.sh deleted file mode 100644 index 7da8cb6..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ~/.bashrc - -GITSHA=$(git rev-parse --short HEAD) - -case "$1" in - container) - sudo -u pelger docker build -t adderservice:$GITSHA . - sudo -u pelger docker tag adderservice:$GITSHA pelger/adderservice:$GITSHA - sudo -i -u pelger docker push pelger/adderservice:$GITSHA - ;; - deploy) - sed -e s/_NAME_/adderservice/ -e s/_PORT_/8080/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/adderservice/ -e s/_PORT_/8080/ -e s/_IMAGE_/pelger\\/adderservice:$GITSHA/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/index.js b/Chapter11/deploying-a-full-system/micro/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/package.json b/Chapter11/deploying-a-full-system/micro/adderservice/package.json deleted file mode 100644 index c612751..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adder-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/service.js b/Chapter11/deploying-a-full-system/micro/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter11/deploying-a-full-system/micro/adderservice/wiring.js b/Chapter11/deploying-a-full-system/micro/adderservice/wiring.js deleted file mode 100644 index 0ed018c..0000000 --- a/Chapter11/deploying-a-full-system/micro/adderservice/wiring.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/.dockerignore b/Chapter11/deploying-a-full-system/micro/auditservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/Dockerfile b/Chapter11/deploying-a-full-system/micro/auditservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/Jenkinsfile b/Chapter11/deploying-a-full-system/micro/auditservice/Jenkinsfile deleted file mode 100644 index 6a75d1a..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('Build') { - steps { - sh 'source ~/.bashrc && cd auditservice && npm install' - } - } - stage('Test'){ - steps { - sh 'source ~/.bashrc && cd auditservice && npm test' - } - } - stage('Container'){ - steps { - sh 'source ~/.bashrc && cd auditservice && sh build.sh container' - } - } - stage('Deploy'){ - steps { - sh 'source ~/.bashrc && cd auditservice && sh build.sh deploy' - } - } - } -} - diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/build.sh b/Chapter11/deploying-a-full-system/micro/auditservice/build.sh deleted file mode 100644 index efa553c..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ~/.bashrc - -GITSHA=$(git rev-parse --short HEAD) - -case "$1" in - container) - sudo -u pelger docker build -t auditservice:$GITSHA . - sudo -u pelger docker tag auditservice:$GITSHA pelger/auditservice:$GITSHA - sudo -i -u pelger docker push pelger/auditservice:$GITSHA - ;; - deploy) - sed -e s/_NAME_/auditservice/ -e s/_PORT_/8081/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/auditservice/ -e s/_PORT_/8081/ -e s/_IMAGE_/pelger\\/auditservice:$GITSHA/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/index.js b/Chapter11/deploying-a-full-system/micro/auditservice/index.js deleted file mode 100644 index 40a4677..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/package.json b/Chapter11/deploying-a-full-system/micro/auditservice/package.json deleted file mode 100644 index bcb0138..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "auditservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "concordant": "^0.2.1", - "mongodb": "^2.2.25", - "restify": "^4.3.0" - } -} diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/service.js b/Chapter11/deploying-a-full-system/micro/auditservice/service.js deleted file mode 100644 index c416e4c..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/service.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { dns } = require('concordant')() - -module.exports = service - -function service () { - - var db - - setup() - - function setup () { - const mongo = '_main._tcp.mongo.micro.svc.cluster.local' - - dns.resolve(mongo, (err, locs) => { - if (err) { - console.error(err) - return - } - const { host, port } = locs[0] - const url = `mongodb://${host}:${port}/audit` - MongoClient.connect(url, (err, client) => { - if (err) { - console.log('failed to connect to MongoDB retrying in 100ms') - setTimeout(setup, 100) - return - } - db = client - db.on('close', () => db = null) - }) - }) - } - - function append (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - const data = { - ts: Date.now(), - calc: args.calc, - result: args.calcResult - } - - audit.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, {result: result.toString()}) - }) - } - - function list (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - audit.find({}, {limit: 10}).toArray((err, docs) => { - if (err) { - cb(err) - return - } - cb(null, {list: docs}) - }) - } - - return { append, list } -} - diff --git a/Chapter11/deploying-a-full-system/micro/auditservice/wiring.js b/Chapter11/deploying-a-full-system/micro/auditservice/wiring.js deleted file mode 100644 index b18dce8..0000000 --- a/Chapter11/deploying-a-full-system/micro/auditservice/wiring.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -const restify = require('restify') -const { AUDITSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.use(restify.bodyParser()) - - server.post('/append', (req, res, next) => { - service.append(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(result) - next() - }) - }) - - server.get('/list', (req, res, next) => { - service.list(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(200, result) - next() - }) - }) - - server.listen(AUDITSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter11/deploying-a-full-system/micro/deployment/deployment-template.yml b/Chapter11/deploying-a-full-system/micro/deployment/deployment-template.yml deleted file mode 100644 index 42ee070..0000000 --- a/Chapter11/deploying-a-full-system/micro/deployment/deployment-template.yml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: _NAME_ -spec: - replicas: 1 - template: - metadata: - labels: - run: _NAME_ - spec: - containers: - - name: _NAME_ - image: _IMAGE_ - ports: - - containerPort: _PORT_ - diff --git a/Chapter11/deploying-a-full-system/micro/deployment/namespace.yml b/Chapter11/deploying-a-full-system/micro/deployment/namespace.yml deleted file mode 100644 index 1351cbb..0000000 --- a/Chapter11/deploying-a-full-system/micro/deployment/namespace.yml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: micro - labels: - name: micro diff --git a/Chapter11/deploying-a-full-system/micro/deployment/service-template.yml b/Chapter11/deploying-a-full-system/micro/deployment/service-template.yml deleted file mode 100644 index 11010f6..0000000 --- a/Chapter11/deploying-a-full-system/micro/deployment/service-template.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: _NAME_ - labels: - run: _NAME_ -spec: - ports: - - port: _PORT_ - name: main - protocol: TCP - targetPort: _PORT_ - selector: - run: _NAME_ - type: NodePort - diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/.dockerignore b/Chapter11/deploying-a-full-system/micro/eventservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/Dockerfile b/Chapter11/deploying-a-full-system/micro/eventservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/Jenkinsfile b/Chapter11/deploying-a-full-system/micro/eventservice/Jenkinsfile deleted file mode 100644 index 81614ce..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('Build') { - steps { - sh 'source ~/.bashrc && cd eventservice && npm install' - } - } - stage('Test'){ - steps { - sh 'source ~/.bashrc && cd eventservice && npm test' - } - } - stage('Container'){ - steps { - sh 'source ~/.bashrc && cd eventservice && sh build.sh container' - } - } - stage('Deploy'){ - steps { - sh 'source ~/.bashrc && cd eventservice && sh build.sh deploy' - } - } - } -} - diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/build.sh b/Chapter11/deploying-a-full-system/micro/eventservice/build.sh deleted file mode 100644 index 68099f0..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ~/.bashrc - -GITSHA=$(git rev-parse --short HEAD) - -case "$1" in - container) - sudo -u pelger docker build -t eventservice:$GITSHA . - sudo -u pelger docker tag eventservice:$GITSHA pelger/eventservice:$GITSHA - sudo -i -u pelger docker push pelger/eventservice:$GITSHA - ;; - deploy) - sed -e s/_NAME_/eventservice/ -e s/_PORT_/8082/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/eventservice/ -e s/_PORT_/8082/ -e s/_IMAGE_/pelger\\/eventservice:$GITSHA/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/index.js b/Chapter11/deploying-a-full-system/micro/eventservice/index.js deleted file mode 100644 index df3a380..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() -wiring(service) diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/package.json b/Chapter11/deploying-a-full-system/micro/eventservice/package.json deleted file mode 100644 index baca7cb..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "event-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "concordant": "^0.2.1", - "mongodb": "^2.2.25", - "redis": "^2.6.5" - } -} diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/service.js b/Chapter11/deploying-a-full-system/micro/eventservice/service.js deleted file mode 100644 index 4082d3e..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/service.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { dns } = require('concordant')() - -module.exports = service - -function service () { - var db - - setup() - - function setup () { - const mongo = '_main._tcp.mongo.micro.svc.cluster.local' - - dns.resolve(mongo, (err, locs) => { - if (err) { - console.error(err) - return - } - const { host, port } = locs[0] - const url = `mongodb://${host}:${port}/events` - MongoClient.connect(url, (err, client) => { - if (err) { - console.log('failed to connect to MongoDB retrying in 100ms') - setTimeout(setup, 100) - return - } - db = client - db.on('close', () => db = null) - }) - }) - } - - function record (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const events = db.collection('events') - const data = { - ts: Date.now(), - eventType: args.type, - url: args.url - } - events.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, result) - }) - } - - function summary (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const summary = {} - const events = db.collection('events') - events.find({}).toArray( (err, docs) => { - if (err) return cb(err) - - docs.forEach(function (doc) { - if (!(summary[doc.url])) { - summary[doc.url] = 1 - } else { - summary[doc.url]++ - } - }) - cb(null, summary) - }) - } - - return { - record: record, - summary: summary - } -} diff --git a/Chapter11/deploying-a-full-system/micro/eventservice/wiring.js b/Chapter11/deploying-a-full-system/micro/eventservice/wiring.js deleted file mode 100644 index b04ab35..0000000 --- a/Chapter11/deploying-a-full-system/micro/eventservice/wiring.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict' - -const { dns } = require('concordant')() -const redis = require('redis') -const QNAME = 'eventservice' - -module.exports = wiring - -function wiring (service) { - - const endpoint = '_main._tcp.redis.micro.svc.cluster.local' - - dns.resolve(endpoint, (err, locs) => { - if (err) { - console.log(err) - return - } - const { port, host } = locs[0] - pullFromQueue(redis.createClient(port, host)) - }) - - function pullFromQueue (client) { - client.brpop(QNAME, 5, function (err, data) { - if (err) console.error(err) - if (err || !data) { - pullFromQueue(client) - return - } - const msg = JSON.parse(data[1]) - const { action, returnPath } = msg - const cmd = service[action] - if (typeof cmd !== 'function') { - pullFromQueue(client) - return - } - cmd(msg, (err, result) => { - if (err) { - console.error(err) - pullFromQueue(client) - return - } - if (!returnPath) { - pullFromQueue(client) - return - } - client.lpush(returnPath, JSON.stringify(result), (err) => { - if (err) console.error(err) - pullFromQueue(client) - }) - }) - }) - } -} diff --git a/Chapter11/deploying-a-full-system/micro/fuge/fuge.yml b/Chapter11/deploying-a-full-system/micro/fuge/fuge.yml deleted file mode 100644 index 839ba34..0000000 --- a/Chapter11/deploying-a-full-system/micro/fuge/fuge.yml +++ /dev/null @@ -1,45 +0,0 @@ -fuge_global: - run_containers: true - dns_enabled: true - dns_host: 127.0.0.1 - dns_port: 53053 - dns_suffix: svc.cluster.local - dns_namespace: micro - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '**/*.log' -adderservice: - type: node - path: ../adderservice - run: node index.js - ports: - - main=8080 -auditservice: - type: process - path: ../auditservice - run: 'node index.js' - ports: - - main=8081 -eventservice: - type: process - path: ../eventservice - run: 'node index.js' -webapp: - type: process - path: ../webapp - run: npm start - ports: - - http=3000 -mongo: - image: mongo - type: container - ports: - - main=27017:27017 -redis: - image: redis - type: container - ports: - - main=6379:6379 diff --git a/Chapter11/deploying-a-full-system/micro/infrastructure/Jenkinsfile b/Chapter11/deploying-a-full-system/micro/infrastructure/Jenkinsfile deleted file mode 100644 index d204b09..0000000 --- a/Chapter11/deploying-a-full-system/micro/infrastructure/Jenkinsfile +++ /dev/null @@ -1,22 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('DeployMongo'){ - steps { - sh 'source ~/.bashrc && cd infrastructure && sh build.sh mongo' - } - } - stage('DeployRedis'){ - steps { - sh 'source ~/.bashrc && cd infrastructure && sh build.sh redis' - } - } - } -} - diff --git a/Chapter11/deploying-a-full-system/micro/infrastructure/build.sh b/Chapter11/deploying-a-full-system/micro/infrastructure/build.sh deleted file mode 100644 index dc36a20..0000000 --- a/Chapter11/deploying-a-full-system/micro/infrastructure/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -sh source ~/.bashrc - -case "$1" in - mongo) - sed -e s/_NAME_/mongo/ -e s/_PORT_/27017/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/mongo/ -e s/_PORT_/27017/ -e s/_IMAGE_/mongo/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - redis) - sed -e s/_NAME_/redis/ -e s/_PORT_/6379/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/redis/ -e s/_PORT_/6379/ -e s/_IMAGE_/redis/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-a-full-system/micro/report/.dockerignore b/Chapter11/deploying-a-full-system/micro/report/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-a-full-system/micro/report/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-a-full-system/micro/report/Dockerfile b/Chapter11/deploying-a-full-system/micro/report/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-a-full-system/micro/report/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-a-full-system/micro/report/env.js b/Chapter11/deploying-a-full-system/micro/report/env.js deleted file mode 100644 index a4d26e9..0000000 --- a/Chapter11/deploying-a-full-system/micro/report/env.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -// provides environment variable setup for concordant - -const env = { - DNS_NAMESPACE: 'micro', - DNS_SUFFIX: 'svc.cluster.local' -} - -if (process.env.NODE_ENV !== 'production') { - Object.assign(env, { - DNS_HOST: '127.0.0.1', - DNS_PORT: '53053' - }) -} - -Object.assign(process.env, env) \ No newline at end of file diff --git a/Chapter11/deploying-a-full-system/micro/report/index.js b/Chapter11/deploying-a-full-system/micro/report/index.js deleted file mode 100644 index b65b65a..0000000 --- a/Chapter11/deploying-a-full-system/micro/report/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict' -require('./env') -const { dns } = require('concordant')() -const redis = require('redis') -const CliTable = require('cli-table') -const QNAME = 'eventservice' -const RESPONSE_QUEUE = 'summary' -const ENDPOINT = '_main._tcp.redis.micro.svc.cluster.local' - -dns.resolve(ENDPOINT, report) - -function report (err, locs) { - if (err) { return console.log(err) } - const { port, host } = locs[0] - const client = redis.createClient(port, host) - const event = JSON.stringify({ - action: 'summary', - returnPath: RESPONSE_QUEUE - }) - - client.lpush(QNAME, event, (err) => { - if (err) { - console.error(err) - return - } - - client.brpop(RESPONSE_QUEUE, 5, (err, data) => { - if (err) { - console.error(err) - return - } - const summary = JSON.parse(data[1]) - const cols = Object.keys(summary).map((url) => [url, summary[url]]) - const table = new CliTable({ - head: ['url', 'count'], - colWidths: [50, 10] - }) - table.push(...cols) - console.log(table.toString()) - client.quit() - }) - }) -} \ No newline at end of file diff --git a/Chapter11/deploying-a-full-system/micro/report/package.json b/Chapter11/deploying-a-full-system/micro/report/package.json deleted file mode 100644 index da2bd04..0000000 --- a/Chapter11/deploying-a-full-system/micro/report/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "report", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "cli-table": "^0.3.1", - "concordant": "^0.2.1", - "redis": "^2.6.5" - } -} diff --git a/Chapter11/deploying-a-full-system/micro/webapp/.dockerignore b/Chapter11/deploying-a-full-system/micro/webapp/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-a-full-system/micro/webapp/Dockerfile b/Chapter11/deploying-a-full-system/micro/webapp/Dockerfile deleted file mode 100644 index b2ffa24..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "npm", "start" ] diff --git a/Chapter11/deploying-a-full-system/micro/webapp/app.js b/Chapter11/deploying-a-full-system/micro/webapp/app.js deleted file mode 100644 index eef315b..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/app.js +++ /dev/null @@ -1,52 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') -var eventLogger = require('./lib/event-logger') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') -var audit = require('./routes/audit') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(eventLogger()) -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) -app.use('/audit', audit) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter11/deploying-a-full-system/micro/webapp/bin/www b/Chapter11/deploying-a-full-system/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter11/deploying-a-full-system/micro/webapp/lib/event-logger.js b/Chapter11/deploying-a-full-system/micro/webapp/lib/event-logger.js deleted file mode 100644 index 0140d3f..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/lib/event-logger.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' - -const { dns } = require('concordant')() -const redis = require('redis') - -module.exports = eventLogger - -function eventLogger () { - const QNAME = 'eventservice' - var client - - const endpoint = '_main._tcp.redis.micro.svc.cluster.local' - dns.resolve(endpoint, (err, locs) => { - if (err) { - console.error(err) - return - } - const { port, host } = locs[0] - client = redis.createClient(port, host) - }) - - function middleware (req, res, next) { - if (!client) { - console.log('client not ready, waiting 100ms') - setTimeout(middleware, 100, req, res, next) - return - } - const event = { - action: 'record', - type: 'page', - url: `${req.protocol}://${req.get('host')}${req.originalUrl}` - } - client.lpush(QNAME, JSON.stringify(event), (err) => { - if (err) console.error(err) - next() - }) - } - - return middleware -} diff --git a/Chapter11/deploying-a-full-system/micro/webapp/package.json b/Chapter11/deploying-a-full-system/micro/webapp/package.json deleted file mode 100644 index 1c45acf..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "concordant": "^0.2.1", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "mu": "^2.1.2", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter11/deploying-a-full-system/micro/webapp/public/stylesheets/style.css b/Chapter11/deploying-a-full-system/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter11/deploying-a-full-system/micro/webapp/routes/add.js b/Chapter11/deploying-a-full-system/micro/webapp/routes/add.js deleted file mode 100644 index 3ab03cc..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/routes/add.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var clients - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', resolve, respond) - -function resolve (req, res, next) { - if (clients) { - next() - return - } - const adderservice = `_main._tcp.adderservice.micro.svc.cluster.local` - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(adderservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const adder = `${host}:${port}` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const audit = `${host}:${port}` - clients = { - adder: restify.createJSONClient({url: `http://${adder}`}), - audit: restify.createJSONClient({url: `http://${audit}`}) - } - next() - }) - }) -} - -function respond (req, res, next) { - const { first, second } = req.body - clients.adder.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - - const { result } = data - clients.audit.post('/append', { - calc: first + '+' + second, - calcResult: result - }, (err) => { - if (err) console.error(err) - }) - - res.render('add', { first, second, result }) - } - ) -} - -module.exports = router diff --git a/Chapter11/deploying-a-full-system/micro/webapp/routes/audit.js b/Chapter11/deploying-a-full-system/micro/webapp/routes/audit.js deleted file mode 100644 index a083eef..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/routes/audit.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var client - -router.get('/', resolve, respond) - -function resolve (req, res, next) { - if (client) { - next() - return - } - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - client = restify.createJSONClient(`http://${host}:${port}`) - }) -} - -function respond (req, res, next) { - client.get('/list', (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - res.render('audit', data) - }) -} - -module.exports = router diff --git a/Chapter11/deploying-a-full-system/micro/webapp/routes/index.js b/Chapter11/deploying-a-full-system/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter11/deploying-a-full-system/micro/webapp/routes/users.js b/Chapter11/deploying-a-full-system/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter11/deploying-a-full-system/micro/webapp/views/add.ejs b/Chapter11/deploying-a-full-system/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter11/deploying-a-full-system/micro/webapp/views/audit.ejs b/Chapter11/deploying-a-full-system/micro/webapp/views/audit.ejs deleted file mode 100644 index dd6d71b..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/views/audit.ejs +++ /dev/null @@ -1,15 +0,0 @@ - - - - Audit - - - -

Calculation History

-
    - <% list.forEach(function (el) { %> -
  • at: <%= new Date(el.ts).toLocaleString() %>, calculated: <%= el.calc %>, result: <%= el.result %>
  • - <% }) %> -
- - \ No newline at end of file diff --git a/Chapter11/deploying-a-full-system/micro/webapp/views/error.ejs b/Chapter11/deploying-a-full-system/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter11/deploying-a-full-system/micro/webapp/views/index.ejs b/Chapter11/deploying-a-full-system/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter11/deploying-a-full-system/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/.dockerignore b/Chapter11/deploying-to-the-cloud/micro/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/Dockerfile b/Chapter11/deploying-to-the-cloud/micro/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/Jenkinsfile b/Chapter11/deploying-to-the-cloud/micro/adderservice/Jenkinsfile deleted file mode 100644 index 8ea826e..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('Build') { - steps { - sh 'source ~/.bashrc && cd adderservice && npm install' - } - } - stage('Test'){ - steps { - sh 'source ~/.bashrc && cd adderservice && npm test' - } - } - stage('Container'){ - steps { - sh 'source ~/.bashrc && cd adderservice && sh build.sh container' - } - } - stage('Deploy'){ - steps { - sh 'source ~/.bashrc && cd adderservice && sh build.sh deploy' - } - } - } -} - diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/build.sh b/Chapter11/deploying-to-the-cloud/micro/adderservice/build.sh deleted file mode 100644 index 7da8cb6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ~/.bashrc - -GITSHA=$(git rev-parse --short HEAD) - -case "$1" in - container) - sudo -u pelger docker build -t adderservice:$GITSHA . - sudo -u pelger docker tag adderservice:$GITSHA pelger/adderservice:$GITSHA - sudo -i -u pelger docker push pelger/adderservice:$GITSHA - ;; - deploy) - sed -e s/_NAME_/adderservice/ -e s/_PORT_/8080/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/adderservice/ -e s/_PORT_/8080/ -e s/_IMAGE_/pelger\\/adderservice:$GITSHA/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/index.js b/Chapter11/deploying-to-the-cloud/micro/adderservice/index.js deleted file mode 100644 index 1f2d9cf..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - - -wiring(service) diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/package.json b/Chapter11/deploying-to-the-cloud/micro/adderservice/package.json deleted file mode 100644 index c612751..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adder-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/service.js b/Chapter11/deploying-to-the-cloud/micro/adderservice/service.js deleted file mode 100644 index 9d0d175..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/adderservice/wiring.js b/Chapter11/deploying-to-the-cloud/micro/adderservice/wiring.js deleted file mode 100644 index 0ed018c..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/adderservice/wiring.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/.dockerignore b/Chapter11/deploying-to-the-cloud/micro/auditservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/Dockerfile b/Chapter11/deploying-to-the-cloud/micro/auditservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/Jenkinsfile b/Chapter11/deploying-to-the-cloud/micro/auditservice/Jenkinsfile deleted file mode 100644 index 6a75d1a..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('Build') { - steps { - sh 'source ~/.bashrc && cd auditservice && npm install' - } - } - stage('Test'){ - steps { - sh 'source ~/.bashrc && cd auditservice && npm test' - } - } - stage('Container'){ - steps { - sh 'source ~/.bashrc && cd auditservice && sh build.sh container' - } - } - stage('Deploy'){ - steps { - sh 'source ~/.bashrc && cd auditservice && sh build.sh deploy' - } - } - } -} - diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/build.sh b/Chapter11/deploying-to-the-cloud/micro/auditservice/build.sh deleted file mode 100644 index efa553c..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ~/.bashrc - -GITSHA=$(git rev-parse --short HEAD) - -case "$1" in - container) - sudo -u pelger docker build -t auditservice:$GITSHA . - sudo -u pelger docker tag auditservice:$GITSHA pelger/auditservice:$GITSHA - sudo -i -u pelger docker push pelger/auditservice:$GITSHA - ;; - deploy) - sed -e s/_NAME_/auditservice/ -e s/_PORT_/8081/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/auditservice/ -e s/_PORT_/8081/ -e s/_IMAGE_/pelger\\/auditservice:$GITSHA/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/index.js b/Chapter11/deploying-to-the-cloud/micro/auditservice/index.js deleted file mode 100644 index 40a4677..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/package.json b/Chapter11/deploying-to-the-cloud/micro/auditservice/package.json deleted file mode 100644 index bcb0138..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "auditservice", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "concordant": "^0.2.1", - "mongodb": "^2.2.25", - "restify": "^4.3.0" - } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/service.js b/Chapter11/deploying-to-the-cloud/micro/auditservice/service.js deleted file mode 100644 index c416e4c..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/service.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { dns } = require('concordant')() - -module.exports = service - -function service () { - - var db - - setup() - - function setup () { - const mongo = '_main._tcp.mongo.micro.svc.cluster.local' - - dns.resolve(mongo, (err, locs) => { - if (err) { - console.error(err) - return - } - const { host, port } = locs[0] - const url = `mongodb://${host}:${port}/audit` - MongoClient.connect(url, (err, client) => { - if (err) { - console.log('failed to connect to MongoDB retrying in 100ms') - setTimeout(setup, 100) - return - } - db = client - db.on('close', () => db = null) - }) - }) - } - - function append (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - const data = { - ts: Date.now(), - calc: args.calc, - result: args.calcResult - } - - audit.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, {result: result.toString()}) - }) - } - - function list (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const audit = db.collection('audit') - audit.find({}, {limit: 10}).toArray((err, docs) => { - if (err) { - cb(err) - return - } - cb(null, {list: docs}) - }) - } - - return { append, list } -} - diff --git a/Chapter11/deploying-to-the-cloud/micro/auditservice/wiring.js b/Chapter11/deploying-to-the-cloud/micro/auditservice/wiring.js deleted file mode 100644 index b18dce8..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/auditservice/wiring.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -const restify = require('restify') -const { AUDITSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.use(restify.bodyParser()) - - server.post('/append', (req, res, next) => { - service.append(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(result) - next() - }) - }) - - server.get('/list', (req, res, next) => { - service.list(req.params, (err, result) => { - if (err) { - res.send(err) - return - } - res.send(200, result) - next() - }) - }) - - server.listen(AUDITSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} - diff --git a/Chapter11/deploying-to-the-cloud/micro/deployment/deployment-template.yml b/Chapter11/deploying-to-the-cloud/micro/deployment/deployment-template.yml deleted file mode 100644 index 42ee070..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/deployment/deployment-template.yml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: _NAME_ -spec: - replicas: 1 - template: - metadata: - labels: - run: _NAME_ - spec: - containers: - - name: _NAME_ - image: _IMAGE_ - ports: - - containerPort: _PORT_ - diff --git a/Chapter11/deploying-to-the-cloud/micro/deployment/namespace.yml b/Chapter11/deploying-to-the-cloud/micro/deployment/namespace.yml deleted file mode 100644 index 1351cbb..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/deployment/namespace.yml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: micro - labels: - name: micro diff --git a/Chapter11/deploying-to-the-cloud/micro/deployment/service-template-lb.yml b/Chapter11/deploying-to-the-cloud/micro/deployment/service-template-lb.yml deleted file mode 100644 index 0f6a1b6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/deployment/service-template-lb.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: _NAME_ - labels: - run: _NAME_ -spec: - ports: - - port: _PORT_ - name: main - protocol: TCP - targetPort: _PORT_ - selector: - run: _NAME_ - type: LoadBalancer - diff --git a/Chapter11/deploying-to-the-cloud/micro/deployment/service-template.yml b/Chapter11/deploying-to-the-cloud/micro/deployment/service-template.yml deleted file mode 100644 index 11010f6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/deployment/service-template.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: _NAME_ - labels: - run: _NAME_ -spec: - ports: - - port: _PORT_ - name: main - protocol: TCP - targetPort: _PORT_ - selector: - run: _NAME_ - type: NodePort - diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/.dockerignore b/Chapter11/deploying-to-the-cloud/micro/eventservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/Dockerfile b/Chapter11/deploying-to-the-cloud/micro/eventservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/Jenkinsfile b/Chapter11/deploying-to-the-cloud/micro/eventservice/Jenkinsfile deleted file mode 100644 index 81614ce..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('Build') { - steps { - sh 'source ~/.bashrc && cd eventservice && npm install' - } - } - stage('Test'){ - steps { - sh 'source ~/.bashrc && cd eventservice && npm test' - } - } - stage('Container'){ - steps { - sh 'source ~/.bashrc && cd eventservice && sh build.sh container' - } - } - stage('Deploy'){ - steps { - sh 'source ~/.bashrc && cd eventservice && sh build.sh deploy' - } - } - } -} - diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/build.sh b/Chapter11/deploying-to-the-cloud/micro/eventservice/build.sh deleted file mode 100644 index 68099f0..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -source ~/.bashrc - -GITSHA=$(git rev-parse --short HEAD) - -case "$1" in - container) - sudo -u pelger docker build -t eventservice:$GITSHA . - sudo -u pelger docker tag eventservice:$GITSHA pelger/eventservice:$GITSHA - sudo -i -u pelger docker push pelger/eventservice:$GITSHA - ;; - deploy) - sed -e s/_NAME_/eventservice/ -e s/_PORT_/8082/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/eventservice/ -e s/_PORT_/8082/ -e s/_IMAGE_/pelger\\/eventservice:$GITSHA/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/index.js b/Chapter11/deploying-to-the-cloud/micro/eventservice/index.js deleted file mode 100644 index df3a380..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() -wiring(service) diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/package.json b/Chapter11/deploying-to-the-cloud/micro/eventservice/package.json deleted file mode 100644 index baca7cb..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "event-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "concordant": "^0.2.1", - "mongodb": "^2.2.25", - "redis": "^2.6.5" - } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/service.js b/Chapter11/deploying-to-the-cloud/micro/eventservice/service.js deleted file mode 100644 index 4082d3e..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/service.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict' - -const { MongoClient } = require('mongodb') -const { dns } = require('concordant')() - -module.exports = service - -function service () { - var db - - setup() - - function setup () { - const mongo = '_main._tcp.mongo.micro.svc.cluster.local' - - dns.resolve(mongo, (err, locs) => { - if (err) { - console.error(err) - return - } - const { host, port } = locs[0] - const url = `mongodb://${host}:${port}/events` - MongoClient.connect(url, (err, client) => { - if (err) { - console.log('failed to connect to MongoDB retrying in 100ms') - setTimeout(setup, 100) - return - } - db = client - db.on('close', () => db = null) - }) - }) - } - - function record (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const events = db.collection('events') - const data = { - ts: Date.now(), - eventType: args.type, - url: args.url - } - events.insert(data, (err, result) => { - if (err) { - cb(err) - return - } - cb(null, result) - }) - } - - function summary (args, cb) { - if (!db) { - cb(Error('No database connection')) - return - } - const summary = {} - const events = db.collection('events') - events.find({}).toArray( (err, docs) => { - if (err) return cb(err) - - docs.forEach(function (doc) { - if (!(summary[doc.url])) { - summary[doc.url] = 1 - } else { - summary[doc.url]++ - } - }) - cb(null, summary) - }) - } - - return { - record: record, - summary: summary - } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/eventservice/wiring.js b/Chapter11/deploying-to-the-cloud/micro/eventservice/wiring.js deleted file mode 100644 index b04ab35..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/eventservice/wiring.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict' - -const { dns } = require('concordant')() -const redis = require('redis') -const QNAME = 'eventservice' - -module.exports = wiring - -function wiring (service) { - - const endpoint = '_main._tcp.redis.micro.svc.cluster.local' - - dns.resolve(endpoint, (err, locs) => { - if (err) { - console.log(err) - return - } - const { port, host } = locs[0] - pullFromQueue(redis.createClient(port, host)) - }) - - function pullFromQueue (client) { - client.brpop(QNAME, 5, function (err, data) { - if (err) console.error(err) - if (err || !data) { - pullFromQueue(client) - return - } - const msg = JSON.parse(data[1]) - const { action, returnPath } = msg - const cmd = service[action] - if (typeof cmd !== 'function') { - pullFromQueue(client) - return - } - cmd(msg, (err, result) => { - if (err) { - console.error(err) - pullFromQueue(client) - return - } - if (!returnPath) { - pullFromQueue(client) - return - } - client.lpush(returnPath, JSON.stringify(result), (err) => { - if (err) console.error(err) - pullFromQueue(client) - }) - }) - }) - } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/fuge/fuge.yml b/Chapter11/deploying-to-the-cloud/micro/fuge/fuge.yml deleted file mode 100644 index 839ba34..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/fuge/fuge.yml +++ /dev/null @@ -1,45 +0,0 @@ -fuge_global: - run_containers: true - dns_enabled: true - dns_host: 127.0.0.1 - dns_port: 53053 - dns_suffix: svc.cluster.local - dns_namespace: micro - tail: true - monitor: true - monitor_excludes: - - '**/node_modules/**' - - '**/.git/**' - - '**/*.log' -adderservice: - type: node - path: ../adderservice - run: node index.js - ports: - - main=8080 -auditservice: - type: process - path: ../auditservice - run: 'node index.js' - ports: - - main=8081 -eventservice: - type: process - path: ../eventservice - run: 'node index.js' -webapp: - type: process - path: ../webapp - run: npm start - ports: - - http=3000 -mongo: - image: mongo - type: container - ports: - - main=27017:27017 -redis: - image: redis - type: container - ports: - - main=6379:6379 diff --git a/Chapter11/deploying-to-the-cloud/micro/infrastructure/Jenkinsfile b/Chapter11/deploying-to-the-cloud/micro/infrastructure/Jenkinsfile deleted file mode 100644 index d204b09..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/infrastructure/Jenkinsfile +++ /dev/null @@ -1,22 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - stage('DeployMongo'){ - steps { - sh 'source ~/.bashrc && cd infrastructure && sh build.sh mongo' - } - } - stage('DeployRedis'){ - steps { - sh 'source ~/.bashrc && cd infrastructure && sh build.sh redis' - } - } - } -} - diff --git a/Chapter11/deploying-to-the-cloud/micro/infrastructure/build.sh b/Chapter11/deploying-to-the-cloud/micro/infrastructure/build.sh deleted file mode 100644 index dc36a20..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/infrastructure/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -sh source ~/.bashrc - -case "$1" in - mongo) - sed -e s/_NAME_/mongo/ -e s/_PORT_/27017/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/mongo/ -e s/_PORT_/27017/ -e s/_IMAGE_/mongo/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - redis) - sed -e s/_NAME_/redis/ -e s/_PORT_/6379/ < ../deployment/service-template.yml > svc.yml - sed -e s/_NAME_/redis/ -e s/_PORT_/6379/ -e s/_IMAGE_/redis/ < ../deployment/deployment-template.yml > dep.yml - sudo -i -u pelger kubectl apply -f $(pwd)/svc.yml - sudo -i -u pelger kubectl apply -f $(pwd)/dep.yml - ;; - *) - echo 'invalid build command' - exit 1 - ;; -esac - diff --git a/Chapter11/deploying-to-the-cloud/micro/report/.dockerignore b/Chapter11/deploying-to-the-cloud/micro/report/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/report/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-to-the-cloud/micro/report/Dockerfile b/Chapter11/deploying-to-the-cloud/micro/report/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/report/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/deploying-to-the-cloud/micro/report/env.js b/Chapter11/deploying-to-the-cloud/micro/report/env.js deleted file mode 100644 index a4d26e9..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/report/env.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -// provides environment variable setup for concordant - -const env = { - DNS_NAMESPACE: 'micro', - DNS_SUFFIX: 'svc.cluster.local' -} - -if (process.env.NODE_ENV !== 'production') { - Object.assign(env, { - DNS_HOST: '127.0.0.1', - DNS_PORT: '53053' - }) -} - -Object.assign(process.env, env) \ No newline at end of file diff --git a/Chapter11/deploying-to-the-cloud/micro/report/index.js b/Chapter11/deploying-to-the-cloud/micro/report/index.js deleted file mode 100644 index b65b65a..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/report/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict' -require('./env') -const { dns } = require('concordant')() -const redis = require('redis') -const CliTable = require('cli-table') -const QNAME = 'eventservice' -const RESPONSE_QUEUE = 'summary' -const ENDPOINT = '_main._tcp.redis.micro.svc.cluster.local' - -dns.resolve(ENDPOINT, report) - -function report (err, locs) { - if (err) { return console.log(err) } - const { port, host } = locs[0] - const client = redis.createClient(port, host) - const event = JSON.stringify({ - action: 'summary', - returnPath: RESPONSE_QUEUE - }) - - client.lpush(QNAME, event, (err) => { - if (err) { - console.error(err) - return - } - - client.brpop(RESPONSE_QUEUE, 5, (err, data) => { - if (err) { - console.error(err) - return - } - const summary = JSON.parse(data[1]) - const cols = Object.keys(summary).map((url) => [url, summary[url]]) - const table = new CliTable({ - head: ['url', 'count'], - colWidths: [50, 10] - }) - table.push(...cols) - console.log(table.toString()) - client.quit() - }) - }) -} \ No newline at end of file diff --git a/Chapter11/deploying-to-the-cloud/micro/report/package.json b/Chapter11/deploying-to-the-cloud/micro/report/package.json deleted file mode 100644 index da2bd04..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/report/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "report", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"no test specified\" && exit 0" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "cli-table": "^0.3.1", - "concordant": "^0.2.1", - "redis": "^2.6.5" - } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/.dockerignore b/Chapter11/deploying-to-the-cloud/micro/webapp/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/Dockerfile b/Chapter11/deploying-to-the-cloud/micro/webapp/Dockerfile deleted file mode 100644 index b2ffa24..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "npm", "start" ] diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/app.js b/Chapter11/deploying-to-the-cloud/micro/webapp/app.js deleted file mode 100644 index eef315b..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/app.js +++ /dev/null @@ -1,52 +0,0 @@ -var express = require('express') -var path = require('path') -var favicon = require('serve-favicon') -var logger = require('morgan') -var cookieParser = require('cookie-parser') -var bodyParser = require('body-parser') -var eventLogger = require('./lib/event-logger') - -var index = require('./routes/index') -var users = require('./routes/users') -var add = require('./routes/add') -var audit = require('./routes/audit') - -var app = express() - -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - -// uncomment after placing your favicon in /public -// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); -app.use(eventLogger()) -app.use(logger('dev')) -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) -app.use(cookieParser()) -app.use(express.static(path.join(__dirname, 'public'))) - -app.use('/', index) -app.use('/users', users) -app.use('/add', add) -app.use('/audit', audit) - -// catch 404 and forward to error handler -app.use(function (req, res, next) { - var err = new Error('Not Found') - err.status = 404 - next(err) -}) - -// error handler -app.use(function (err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message - res.locals.error = req.app.get('env') === 'development' ? err : {} - - // render the error page - res.status(err.status || 500) - res.render('error') -}) - -module.exports = app diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/bin/www b/Chapter11/deploying-to-the-cloud/micro/webapp/bin/www deleted file mode 100644 index 8715eeb..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/bin/www +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('webapp:server'); -var http = require('http'); - -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3000'); -app.set('port', port); - -/** - * Create HTTP server. - */ - -var server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/lib/event-logger.js b/Chapter11/deploying-to-the-cloud/micro/webapp/lib/event-logger.js deleted file mode 100644 index 0140d3f..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/lib/event-logger.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' - -const { dns } = require('concordant')() -const redis = require('redis') - -module.exports = eventLogger - -function eventLogger () { - const QNAME = 'eventservice' - var client - - const endpoint = '_main._tcp.redis.micro.svc.cluster.local' - dns.resolve(endpoint, (err, locs) => { - if (err) { - console.error(err) - return - } - const { port, host } = locs[0] - client = redis.createClient(port, host) - }) - - function middleware (req, res, next) { - if (!client) { - console.log('client not ready, waiting 100ms') - setTimeout(middleware, 100, req, res, next) - return - } - const event = { - action: 'record', - type: 'page', - url: `${req.protocol}://${req.get('host')}${req.originalUrl}` - } - client.lpush(QNAME, JSON.stringify(event), (err) => { - if (err) console.error(err) - next() - }) - } - - return middleware -} diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/package.json b/Chapter11/deploying-to-the-cloud/micro/webapp/package.json deleted file mode 100644 index 1c45acf..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "webapp", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.16.0", - "concordant": "^0.2.1", - "cookie-parser": "~1.4.3", - "debug": "~2.6.0", - "ejs": "~2.5.5", - "express": "~4.14.1", - "morgan": "~1.7.0", - "mu": "^2.1.2", - "restify": "^4.3.0", - "serve-favicon": "~2.3.2" - } -} diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/public/stylesheets/style.css b/Chapter11/deploying-to-the-cloud/micro/webapp/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/add.js b/Chapter11/deploying-to-the-cloud/micro/webapp/routes/add.js deleted file mode 100644 index 3ab03cc..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/add.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var clients - -router.get('/', function (req, res) { - res.render('add', { first: 0, second: 0, result: 0 }) -}) - -router.post('/calculate', resolve, respond) - -function resolve (req, res, next) { - if (clients) { - next() - return - } - const adderservice = `_main._tcp.adderservice.micro.svc.cluster.local` - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(adderservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const adder = `${host}:${port}` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - const audit = `${host}:${port}` - clients = { - adder: restify.createJSONClient({url: `http://${adder}`}), - audit: restify.createJSONClient({url: `http://${audit}`}) - } - next() - }) - }) -} - -function respond (req, res, next) { - const { first, second } = req.body - clients.adder.get( - `/add/${first}/${second}`, - (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - - const { result } = data - clients.audit.post('/append', { - calc: first + '+' + second, - calcResult: result - }, (err) => { - if (err) console.error(err) - }) - - res.render('add', { first, second, result }) - } - ) -} - -module.exports = router diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/audit.js b/Chapter11/deploying-to-the-cloud/micro/webapp/routes/audit.js deleted file mode 100644 index a083eef..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/audit.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const { Router } = require('express') -const restify = require('restify') -const { dns } = require('concordant')() -const router = Router() -var client - -router.get('/', resolve, respond) - -function resolve (req, res, next) { - if (client) { - next() - return - } - const auditservice = `_main._tcp.auditservice.micro.svc.cluster.local` - dns.resolve(auditservice, (err, locs) => { - if (err) { - next(err) - return - } - const { host, port } = locs[0] - client = restify.createJSONClient(`http://${host}:${port}`) - }) -} - -function respond (req, res, next) { - client.get('/list', (err, svcReq, svcRes, data) => { - if (err) { - next(err) - return - } - res.render('audit', data) - }) -} - -module.exports = router diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/index.js b/Chapter11/deploying-to-the-cloud/micro/webapp/routes/index.js deleted file mode 100644 index 956680b..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('index', { title: 'Express' }) -}) - -module.exports = router diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/users.js b/Chapter11/deploying-to-the-cloud/micro/webapp/routes/users.js deleted file mode 100644 index 8cfe88f..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET users listing. */ -router.get('/', function (req, res, next) { - res.send('respond with a resource') -}) - -module.exports = router diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/views/add.ejs b/Chapter11/deploying-to-the-cloud/micro/webapp/views/add.ejs deleted file mode 100644 index da8279c..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/views/add.ejs +++ /dev/null @@ -1,16 +0,0 @@ - - - - Add - - - -

Add it up!

-
- > - > -
- -

result = <%= result %>

- - diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/views/audit.ejs b/Chapter11/deploying-to-the-cloud/micro/webapp/views/audit.ejs deleted file mode 100644 index dd6d71b..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/views/audit.ejs +++ /dev/null @@ -1,15 +0,0 @@ - - - - Audit - - - -

Calculation History

-
    - <% list.forEach(function (el) { %> -
  • at: <%= new Date(el.ts).toLocaleString() %>, calculated: <%= el.calc %>, result: <%= el.result %>
  • - <% }) %> -
- - \ No newline at end of file diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/views/error.ejs b/Chapter11/deploying-to-the-cloud/micro/webapp/views/error.ejs deleted file mode 100644 index 7cf94ed..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/Chapter11/deploying-to-the-cloud/micro/webapp/views/index.ejs b/Chapter11/deploying-to-the-cloud/micro/webapp/views/index.ejs deleted file mode 100644 index 7b7a1d6..0000000 --- a/Chapter11/deploying-to-the-cloud/micro/webapp/views/index.ejs +++ /dev/null @@ -1,11 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>

- - diff --git a/Chapter11/running-a-docker-registry/micro/adderservice/.dockerignore b/Chapter11/running-a-docker-registry/micro/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/running-a-docker-registry/micro/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/running-a-docker-registry/micro/adderservice/Dockerfile b/Chapter11/running-a-docker-registry/micro/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/running-a-docker-registry/micro/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/running-a-docker-registry/micro/adderservice/index.js b/Chapter11/running-a-docker-registry/micro/adderservice/index.js deleted file mode 100644 index 753a4ce..0000000 --- a/Chapter11/running-a-docker-registry/micro/adderservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) \ No newline at end of file diff --git a/Chapter11/running-a-docker-registry/micro/adderservice/package.json b/Chapter11/running-a-docker-registry/micro/adderservice/package.json deleted file mode 100644 index 595a5b0..0000000 --- a/Chapter11/running-a-docker-registry/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adder-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter11/running-a-docker-registry/micro/adderservice/service.js b/Chapter11/running-a-docker-registry/micro/adderservice/service.js deleted file mode 100644 index af95084..0000000 --- a/Chapter11/running-a-docker-registry/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} \ No newline at end of file diff --git a/Chapter11/running-a-docker-registry/micro/adderservice/wiring.js b/Chapter11/running-a-docker-registry/micro/adderservice/wiring.js deleted file mode 100644 index 0e81c6c..0000000 --- a/Chapter11/running-a-docker-registry/micro/adderservice/wiring.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} \ No newline at end of file diff --git a/Chapter11/running-a-docker-registry/micro/certs/localhost.crt b/Chapter11/running-a-docker-registry/micro/certs/localhost.crt deleted file mode 100644 index ba20df3..0000000 --- a/Chapter11/running-a-docker-registry/micro/certs/localhost.crt +++ /dev/null @@ -1,34 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIF9DCCA9ygAwIBAgIJANNfvhUTrvvCMA0GCSqGSIb3DQEBCwUAMFkxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xNzA0MjQxNTEx -MDJaFw0xODA0MjQxNTExMDJaMFkxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21l -LVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNV -BAMTCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMAG -+IOL0sVf1S/4YZ9bzMgIb+n9Z4f5EZQ+6Cs43ohmFpnNcHPw5GsW8I4rKNBmA+Lh -Bgix9HwjWi7ZagbCYErw3avFRA9xSd8MUelLuIzSfhKZVSsMeDNiE1z9PtdkTASz -i2bSgxx4iH1uGH0WDwC84vzMiIX3gNGsbThGVcjG7IFuS4QdeUA2n8zLcPG6lRLB -gPXD6v21bVKBo7FS7UthLWsa1dhvUKk/dpMaVMXINCS90TkyXxIjTkfy8epwD+Vr -98CLboooqt1ETwSdNii0QtP+6fkZ5dhjMfOLmuJ70bEGeK95CjW2ajRDwooNbp0j -dzdPfYGj2tuYQfKf+EJLanTE1W3ohUCAwYpmD8xZ+tsNKxcvCFy8iypBMRiyKKLr -swVaaO3qaM/suGSeTtKGBj2HKPU2IlTvjHfa/sogJyyHdhye0Wy1xQijsDzgL9x3 -+PfoprlQ6mhGCTi4q+oJnmqVq6A6xdvo6L/pYbh/6C5GcdUoILAjL3q4bFxt+PEP -AX+ZYpiZy9q3qRizZuysVMBcNbyNOH9uGXpX13QBjL39rQmIel3ieAmwB4LWsM+x -6+JmPtA/UJ4WyImbUQMW9PM0KQdEkv569VBg6jo0hwjuMaliPCbZZIqBqXpTzAyr -ctMSu6HMmYmicmsThqlHk/C027YqEnRZJao4jz9pAgMBAAGjgb4wgbswHQYDVR0O -BBYEFGHzPwViRuKw8MgGm+HhTnox0k/aMIGLBgNVHSMEgYMwgYCAFGHzPwViRuKw -8MgGm+HhTnox0k/aoV2kWzBZMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1T -dGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRIwEAYDVQQD -Ewlsb2NhbGhvc3SCCQDTX74VE677wjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEB -CwUAA4ICAQBPdvbD/IQGPiW4GOxux+tmF83ZDNI/mA4WaNcEsn/edm89TYowktkZ -6f7uMak4CBp0M+1wVGmi0iuM+GrQNysnVbo918+W3OPV1ukons1U6DyzT/0ObsiG -3Iicos64xK5u95AdTvH1Hk0nyGN6Q+O9Pp/clRNA3ulESCjFMOr6pTSjxBZbb1CP -87waZrIB/NVOxFQKPkqJd8e8Q4tiG5e5/ZmhuoYlcU82tTH7dqYFhwQMCvLkZjbv -c9vBcImfS0Qz7nTgh3ZzZIsAyo1BOj24SxRwM/8sCf051VWIJnd0ds4LploeL6dK -QntMK5hVHFLwdfx5glbOSFr1bLGuFQufZSI36bIpkYPd7clmVSwt/tD3C+YEhPBq -7s/DZj8fyvNFxg2tBH6Lw0Z8QM+UVC8eQNUbaVuVDmw3M5/4szDt98hrniUBW4zF -Ep7J3ERSSB7KRwlj623KaF+9EhWKFQTazcVxtSF7a2UmTMuXpIlWgATbYPsXP5fE -wivMvYjXiJrdUuJoAXaGMU+Eo7yT5oEZgRr4LeoOjaCDeWCpoMPxsZ3JnNWqodCN -ZQxGEewNrt/fHdEaEIO79R24t1so4be3vi/1fUU/l4ewdw0ImQvC6IZAFrCUlOsL -rvwPu37M6Mgj4VZ6tcfNWgPUGuhpK9TFIF4R2l0heeHsOs/tpxb3bw== ------END CERTIFICATE----- diff --git a/Chapter11/running-a-docker-registry/micro/certs/localhost.key b/Chapter11/running-a-docker-registry/micro/certs/localhost.key deleted file mode 100644 index 1415238..0000000 --- a/Chapter11/running-a-docker-registry/micro/certs/localhost.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEAwAb4g4vSxV/VL/hhn1vMyAhv6f1nh/kRlD7oKzjeiGYWmc1w -c/Dkaxbwjiso0GYD4uEGCLH0fCNaLtlqBsJgSvDdq8VED3FJ3wxR6Uu4jNJ+EplV -Kwx4M2ITXP0+12RMBLOLZtKDHHiIfW4YfRYPALzi/MyIhfeA0axtOEZVyMbsgW5L -hB15QDafzMtw8bqVEsGA9cPq/bVtUoGjsVLtS2EtaxrV2G9QqT92kxpUxcg0JL3R -OTJfEiNOR/Lx6nAP5Wv3wItuiiiq3URPBJ02KLRC0/7p+Rnl2GMx84ua4nvRsQZ4 -r3kKNbZqNEPCig1unSN3N099gaPa25hB8p/4QktqdMTVbeiFQIDBimYPzFn62w0r -Fy8IXLyLKkExGLIoouuzBVpo7epoz+y4ZJ5O0oYGPYco9TYiVO+Md9r+yiAnLId2 -HJ7RbLXFCKOwPOAv3Hf49+imuVDqaEYJOLir6gmeapWroDrF2+jov+lhuH/oLkZx -1SggsCMverhsXG348Q8Bf5limJnL2repGLNm7KxUwFw1vI04f24ZelfXdAGMvf2t -CYh6XeJ4CbAHgtawz7Hr4mY+0D9QnhbIiZtRAxb08zQpB0SS/nr1UGDqOjSHCO4x -qWI8JtlkioGpelPMDKty0xK7ocyZiaJyaxOGqUeT8LTbtioSdFklqjiPP2kCAwEA -AQKCAgBEbzeJyf7nkGutmNtRq6mjcD5SKZkIAF+fcXvUS4QjIB7V2T1GVIdTEu3P -/Nmiy3h/FqrL1n/G7eJp59m9ZvBiRMz7NmY3CqzE7OMUPYQby7hacILFwL/lsAIu -laIbqQbedg4sKsHHF72s1dusWHwoSyip50qQU9B46PZTo91WnG4VAnWvM8HOfKke -lzI9M72E3alT7OqGWG4JhWINA/zWbHB/RyUG6UTZzGA5tJyZj+vlXDCALc9r62Eu -iwpj/mPr4zp8SDSw0CV0ja+LeWufvf5DBwnjWLNtFozqusoMBQyKBkBkaMKWudfH -oI5oHLlbDxShhZa46OhKckyuZwxWFMO7Hv+3TTLik0Sg3bXTs9iCiXhWI+21le1E -LLpZRM36q1UBrXCuzPfenbMkI6OFp+Nz5HVDHf1gRPoYRgVhyrIawc3Bs1lUWFx/ -BM/CdDtabMS+kv3eydXtQ3AkkRxlLSAkqYAXG3kd3Rnyzmxb8+cbTBnkBY1hI4fr -43g30Bg0pinUvSAKoGFTkoA99FKvekjyOQBo62/GiCAYqO5DG7/lHrF6LHWuJ6/H -CgLVTjqUpd4bpcLSokmT9cF43f/vdrRotM2xvd/MsGisiG/0dO1788OR4biUIav3 -1RuSF8YXBVGUfQOvsgcK3Gwvrc0CtWa6Qv7Cu6TwQ6AE1sei8QKCAQEA+uuIl/UB -AhNXpqQsk72fgUMxAJXjiuZc/Ed66kewxLqAQRaT1OtrjqcyY1XyFL4TCVAzTk5v -H1N7aer8urVwFtN7r3xQmWrlJI+ANhx0L6b/smxR0/ndk6sI9IRSBFOgJrRFKpR3 -Cwdn7hi5W6WeSSMTQwIgI+e+VdUz2ByHhImQkcIFk9hXqs9dBm9ud8yr0qa6ebet -0jLc8RCekQCoo5wV+UfSy9ev/G/nDCV7FGsnhQe7b21m7OIQ8RjhNNy7A/dlrhnY -pD6IxnMQY3tbwqwJjip/eZJyLNdngbLVw0nkxNyJg0s0Ypx0eR3Iy0I3BzKrCTip -BDCG3TMAtFzmewKCAQEAw+o1O1uONf8LBqsFq9dPrvn5CGLfxC8MNNsYlcFPvD8Y -9naYg9earFrDk0YaxtygUjcHX43vO6y3CRckZzThB0+vZdizablle4qYapv9m7uw -+JeHb/OlPtcJG57bNC5OQQgHD5TldCMDt48uwPPjfq7XjCuHmeMzpQFejuTcwaAU -Fqv04ar2nWUOrvKL4x6/2mujkS2sCpbz/m5CUIStAWXtWT9HrtOUXevqEBxv1K/9 -I29LLhO94hp6vYsFIltoDPw+dhL39WmboIuUBmpjGrfIKbYq2/ccxtspNrrkttNH -YvaifVR91h6c59bkBnOHOdTj4aPz/9/Hxd1C+wGeawKCAQBXz4ua2jQDHO/Espmj -Dm4+l1wTv2DFID8UTpOWX4ZeIoJ1xMfxcH3Qi3SXzOEOH0KcNMPvuIUs6lM7SvAt -CwfyBQq47AFs3zrXo5yT0ztZ3dCICV5Nl5jSb72PjKsDNpzKTrYR46kRZAMcEOz1 -RK1zHOJFxf2ncxdqBFXDYKCQYnAEgmjfR4vOjAkbEm4PYMIU0yJZLE2ZTRGDD3Te -e+OIdjw+Y8NCcPX2mta5qng7OhC3fnA624d0iNyy8ykFDeYoyjB8UDE/sV6+TFBE -8Eu5gelKJlc8HWL1jGB9xC8Iy9hSiHdbSjtH80bTh/fYIhEN5M50SK7ld3ILASlS -9Vv3AoIBAG4AzY7co4cSA2DlGjQYmzdGSFw7GCWRvSrYcn9zoY+zZhLNGGm+36wy -8ml5DYPnUWWYXF181n0NR2ClS91fRZLTXUq0WFjermqlsVr653VP99g9TODBT2Fv -YD/P/IjaDzpYhY5sLkH9fxLMJJZW2r/A8GpV7reraM4XbL6TJpjZhy4Ls14anopV -ud7ldUI7e8HqelcD6/uuMqYDxtxrArEsSA66h0dUqZPq6OvO68PiZSJGVVIz54RT -FePjcSiPZmcUIwYtNGjpuWZ1uNG5Xpgb5Rn2nS4RHGlTmVqPqeg1zXl1vlrc3CMj -4ToT4Mj2iVEhhiql4lUjk4o36GoDyK0CggEBAI1Nw1tna7iU1jLcOaCcaXALa8qI -AqjmtmUeQAD9zvjZaWfU9wS8EK2UNB02fG16Fxd1MMNzU9+rzZ2dmUyEFjGbRG8L -nexR1lAuGdALP2lvU9GhBCSkZ9BpBIfaH3n/j0fWG6LKdAjnoyYCtazTqCSESQFH -jymtnlX40y27FoBV5hKVM7pgjxpBusRTm4r08Ml7slzqQXxuaQc/x9y1db3lXtTq -NSXP+wYTPFIwqpC9GWokZLGhF/Il//jKKOymUMKIQX0gYJ9Zt1sPUtOZs8saEZZA -uVFa27HCSCQVNQImCQ0vQZmXd7g7xeTvFFo4hpfKGyMclHT13hCwm18rmNw= ------END RSA PRIVATE KEY----- diff --git a/Chapter11/storing-images-on-dockerhub/micro/adderservice/.dockerignore b/Chapter11/storing-images-on-dockerhub/micro/adderservice/.dockerignore deleted file mode 100644 index 90718e6..0000000 --- a/Chapter11/storing-images-on-dockerhub/micro/adderservice/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.gitignore -node_modules -npm-debug.log diff --git a/Chapter11/storing-images-on-dockerhub/micro/adderservice/Dockerfile b/Chapter11/storing-images-on-dockerhub/micro/adderservice/Dockerfile deleted file mode 100644 index 4d2e56b..0000000 --- a/Chapter11/storing-images-on-dockerhub/micro/adderservice/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:slim -RUN mkdir -p /home/node/service -WORKDIR /home/node/service -COPY package.json /home/node/service -RUN npm install -COPY . /home/node/service -CMD [ "node", "index.js" ] diff --git a/Chapter11/storing-images-on-dockerhub/micro/adderservice/index.js b/Chapter11/storing-images-on-dockerhub/micro/adderservice/index.js deleted file mode 100644 index 753a4ce..0000000 --- a/Chapter11/storing-images-on-dockerhub/micro/adderservice/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const wiring = require('./wiring') -const service = require('./service')() - -wiring(service) \ No newline at end of file diff --git a/Chapter11/storing-images-on-dockerhub/micro/adderservice/package.json b/Chapter11/storing-images-on-dockerhub/micro/adderservice/package.json deleted file mode 100644 index 595a5b0..0000000 --- a/Chapter11/storing-images-on-dockerhub/micro/adderservice/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "adder-service", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Peter Elger ", - "license": "ISC", - "dependencies": { - "restify": "^4.3.0" - } -} diff --git a/Chapter11/storing-images-on-dockerhub/micro/adderservice/service.js b/Chapter11/storing-images-on-dockerhub/micro/adderservice/service.js deleted file mode 100644 index af95084..0000000 --- a/Chapter11/storing-images-on-dockerhub/micro/adderservice/service.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -module.exports = service - -function service () { - function add (args, cb) { - const {first, second} = args - const result = (parseInt(first, 10) + parseInt(second, 10)) - cb(null, {result: result.toString()}) - } - - return { add } -} \ No newline at end of file diff --git a/Chapter11/storing-images-on-dockerhub/micro/adderservice/wiring.js b/Chapter11/storing-images-on-dockerhub/micro/adderservice/wiring.js deleted file mode 100644 index 0e81c6c..0000000 --- a/Chapter11/storing-images-on-dockerhub/micro/adderservice/wiring.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const restify = require('restify') -const { ADDERSERVICE_SERVICE_PORT } = process.env - -module.exports = wiring - -function wiring (service) { - const server = restify.createServer() - - server.get('/add/:first/:second', (req, res, next) => { - service.add(req.params, (err, result) => { - if (err) { - res.send(err) - next() - return - } - res.send(200, result) - next() - }) - }) - - server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { - console.log('%s listening at %s', server.name, server.url) - }) -} \ No newline at end of file diff --git a/Chapter11/storing-images-on-dockerhub/test.sh b/Chapter11/storing-images-on-dockerhub/test.sh deleted file mode 100644 index 5086478..0000000 --- a/Chapter11/storing-images-on-dockerhub/test.sh +++ /dev/null @@ -1 +0,0 @@ -curl http://localhost:8080/add/2/3