From 1b228200edda433185f7565e491d1779cf787e3c Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 13:41:17 -0800 Subject: [PATCH 01/10] set up initial file structure --- lab-shannon/.eslintignore | 4 + lab-shannon/.eslintrc.json | 38 ++ lab-shannon/.gitignore | 150 ++++++++ lab-shannon/README.md | 0 lab-shannon/index.js | 0 lab-shannon/model/chatMessage.js | 0 lab-shannon/package-lock.json | 608 +++++++++++++++++++++++++++++++ lab-shannon/package.json | 15 + 8 files changed, 815 insertions(+) create mode 100644 lab-shannon/.eslintignore create mode 100644 lab-shannon/.eslintrc.json create mode 100644 lab-shannon/.gitignore create mode 100644 lab-shannon/README.md create mode 100644 lab-shannon/index.js create mode 100644 lab-shannon/model/chatMessage.js create mode 100644 lab-shannon/package-lock.json create mode 100644 lab-shannon/package.json diff --git a/lab-shannon/.eslintignore b/lab-shannon/.eslintignore new file mode 100644 index 0000000..4e3663d --- /dev/null +++ b/lab-shannon/.eslintignore @@ -0,0 +1,4 @@ +**/node_modules/* +**/vendor/* +**/*.min.js +**/coverage/* diff --git a/lab-shannon/.eslintrc.json b/lab-shannon/.eslintrc.json new file mode 100644 index 0000000..38847fb --- /dev/null +++ b/lab-shannon/.eslintrc.json @@ -0,0 +1,38 @@ +{ + "env": { + "browser": true, + "node": true, + "commonjs": true, + "jest": true, + "es6": true + }, + "globals": { + "err": true, + "req": true, + "res": true, + "next": true, + "__API_URI__": false, + "__TITLE__": false, + "__DEBUG__": false + }, + "extends": ["eslint:recommended", "plugin:react/recommended"], + "parserOptions": { + "sourceType": "module", + "ecmaVersion": 6, + "ecmaFeatures": { + "experimentalObjectRestSpread": true, + "module": true, + "jsx": true + } + }, + "rules": { + "no-console": "off", + "no-unused-vars": "off", + "indent": [ "error", 2, { "SwitchCase": 1 } ], + "react/prop-types": [0], + "quotes": ["error", "single", { "allowTemplateLiterals": true }], + "space-infix-ops": ["error", {"int32Hint": false}], + "comma-dangle": ["error", "always-multiline"], + "semi": [ "error", "always" ] + }, +} diff --git a/lab-shannon/.gitignore b/lab-shannon/.gitignore new file mode 100644 index 0000000..b6f8235 --- /dev/null +++ b/lab-shannon/.gitignore @@ -0,0 +1,150 @@ +.env +node_modules/ +# Created by https://www.gitignore.io/api/osx,vim,node,linux,windows,visualstudiocode + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + + +### OSX ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Vim ### +# swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-v][a-z] +[._]sw[a-p] +# session +Session.vim +# temporary +.netrwhist +# auto-generated tag files +tags + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.gitignore.io/api/osx,vim,node,linux,windows,visualstudiocode diff --git a/lab-shannon/README.md b/lab-shannon/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lab-shannon/index.js b/lab-shannon/index.js new file mode 100644 index 0000000..e69de29 diff --git a/lab-shannon/model/chatMessage.js b/lab-shannon/model/chatMessage.js new file mode 100644 index 0000000..e69de29 diff --git a/lab-shannon/package-lock.json b/lab-shannon/package-lock.json new file mode 100644 index 0000000..7eb0b51 --- /dev/null +++ b/lab-shannon/package-lock.json @@ -0,0 +1,608 @@ +{ + "name": "lab-shannon", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", + "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", + "requires": { + "mime-types": "2.1.17", + "negotiator": "0.6.1" + } + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + }, + "base64id": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", + "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=" + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "requires": { + "callsite": "1.0.0" + } + }, + "blob": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", + "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=" + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "1.0.4", + "debug": "2.6.9", + "depd": "1.1.2", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "1.6.15" + } + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "engine.io": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.1.4.tgz", + "integrity": "sha1-PQIRtwpVLOhB/8fahiezAamkFi4=", + "requires": { + "accepts": "1.3.3", + "base64id": "1.0.0", + "cookie": "0.3.1", + "debug": "2.6.9", + "engine.io-parser": "2.1.2", + "uws": "0.14.5", + "ws": "3.3.3" + }, + "dependencies": { + "accepts": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", + "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", + "requires": { + "mime-types": "2.1.17", + "negotiator": "0.6.1" + } + } + } + }, + "engine.io-client": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.1.4.tgz", + "integrity": "sha1-T88TcLRxY70s6b4nM5ckMDUNTqE=", + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "2.6.9", + "engine.io-parser": "2.1.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "3.3.3", + "xmlhttprequest-ssl": "1.5.5", + "yeast": "0.1.2" + } + }, + "engine.io-parser": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.2.tgz", + "integrity": "sha512-dInLFzr80RijZ1rGpx1+56/uFoH7/7InhH3kZt+Ms6hT8tNx3NGW/WNSA/f8As1WkOfkuyb3tnRyuXGxusclMw==", + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.4", + "has-binary2": "1.0.2" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "express": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.2.tgz", + "integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=", + "requires": { + "accepts": "1.3.4", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "finalhandler": "1.1.0", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "2.0.2", + "qs": "6.5.1", + "range-parser": "1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.1", + "serve-static": "1.13.1", + "setprototypeof": "1.1.0", + "statuses": "1.3.1", + "type-is": "1.6.15", + "utils-merge": "1.0.1", + "vary": "1.1.2" + } + }, + "finalhandler": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", + "requires": { + "debug": "2.6.9", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.3.1", + "unpipe": "1.0.0" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "has-binary2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.2.tgz", + "integrity": "sha1-6D26SfC5vk0CbSc2U1DZ8D9Uvpg=", + "requires": { + "isarray": "2.0.1" + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": "1.3.1" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + } + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz", + "integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A=" + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "requires": { + "mime-db": "1.30.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "requires": { + "better-assert": "1.0.2" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "requires": { + "better-assert": "1.0.2" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "proxy-addr": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", + "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", + "requires": { + "forwarded": "0.1.2", + "ipaddr.js": "1.5.2" + } + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "send": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", + "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", + "requires": { + "debug": "2.6.9", + "depd": "1.1.2", + "destroy": "1.0.4", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "fresh": "0.5.2", + "http-errors": "1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "2.3.0", + "range-parser": "1.2.0", + "statuses": "1.3.1" + } + }, + "serve-static": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", + "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", + "requires": { + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "parseurl": "1.3.2", + "send": "0.16.1" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "socket.io": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.0.4.tgz", + "integrity": "sha1-waRZDO/4fs8TxyZS8Eb3FrKeYBQ=", + "requires": { + "debug": "2.6.9", + "engine.io": "3.1.4", + "socket.io-adapter": "1.1.1", + "socket.io-client": "2.0.4", + "socket.io-parser": "3.1.2" + } + }, + "socket.io-adapter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz", + "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=" + }, + "socket.io-client": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.0.4.tgz", + "integrity": "sha1-CRilUkBtxeVAs4Dc2Xr8SmQzL44=", + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "2.6.9", + "engine.io-client": "3.1.4", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "3.1.2", + "to-array": "0.1.4" + } + }, + "socket.io-parser": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.1.2.tgz", + "integrity": "sha1-28IoIVH8T6675Aru3Ady66YZ9/I=", + "requires": { + "component-emitter": "1.2.1", + "debug": "2.6.9", + "has-binary2": "1.0.2", + "isarray": "2.0.1" + } + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + }, + "type-is": { + "version": "1.6.15", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", + "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", + "requires": { + "media-typer": "0.3.0", + "mime-types": "2.1.17" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uws": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/uws/-/uws-0.14.5.tgz", + "integrity": "sha1-Z6rzPEaypYel9mZtAPdpEyjxSdw=", + "optional": true + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "1.0.0", + "safe-buffer": "5.1.1", + "ultron": "1.1.1" + } + }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" + } + } +} diff --git a/lab-shannon/package.json b/lab-shannon/package.json new file mode 100644 index 0000000..13f7ef4 --- /dev/null +++ b/lab-shannon/package.json @@ -0,0 +1,15 @@ +{ + "name": "lab-shannon", + "version": "1.0.0", + "description": "chat app using socket.io", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "shannon", + "license": "MIT", + "dependencies": { + "express": "^4.16.2", + "socket.io": "^2.0.4" + } +} From 665249ab6c67ff07b156619383778fe5e910f20f Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 14:30:26 -0800 Subject: [PATCH 02/10] set up server file and basics of main.js --- lab-shannon/.eslintrc.json | 2 +- lab-shannon/app.js | 17 +++++++++++++++++ lab-shannon/index.js | 0 lab-shannon/model/chatMessage.js | 0 lab-shannon/package-lock.json | 5 +++++ lab-shannon/package.json | 6 ++++-- lab-shannon/public/index.html | 12 ++++++++++++ lab-shannon/public/main.js | 7 +++++++ lab-shannon/public/model/chatMessage.js | 24 ++++++++++++++++++++++++ 9 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 lab-shannon/app.js delete mode 100644 lab-shannon/index.js delete mode 100644 lab-shannon/model/chatMessage.js create mode 100644 lab-shannon/public/index.html create mode 100644 lab-shannon/public/main.js create mode 100644 lab-shannon/public/model/chatMessage.js diff --git a/lab-shannon/.eslintrc.json b/lab-shannon/.eslintrc.json index 38847fb..859e948 100644 --- a/lab-shannon/.eslintrc.json +++ b/lab-shannon/.eslintrc.json @@ -34,5 +34,5 @@ "space-infix-ops": ["error", {"int32Hint": false}], "comma-dangle": ["error", "always-multiline"], "semi": [ "error", "always" ] - }, + } } diff --git a/lab-shannon/app.js b/lab-shannon/app.js new file mode 100644 index 0000000..46c7a13 --- /dev/null +++ b/lab-shannon/app.js @@ -0,0 +1,17 @@ +'use strict'; + +const express = require('express'); +const app = express(); +const http = require('http').createServer(app); +const io = require('socket.io')(http); +const PORT = 3000; + +app.use(express.static('./public')); + +io.on('connection', (socket) => { + console.log(`${socket.id} joined`); +}); + +http.listen(PORT, () => { + console.log(`Listening on port: ${PORT}`); +}); diff --git a/lab-shannon/index.js b/lab-shannon/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/lab-shannon/model/chatMessage.js b/lab-shannon/model/chatMessage.js deleted file mode 100644 index e69de29..0000000 diff --git a/lab-shannon/package-lock.json b/lab-shannon/package-lock.json index 7eb0b51..b42cc58 100644 --- a/lab-shannon/package-lock.json +++ b/lab-shannon/package-lock.json @@ -290,6 +290,11 @@ "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" }, + "http": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/http/-/http-0.0.0.tgz", + "integrity": "sha1-huYybSnF0Dnen6xYSkVon5KfT3I=" + }, "http-errors": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", diff --git a/lab-shannon/package.json b/lab-shannon/package.json index 13f7ef4..7ffd0c7 100644 --- a/lab-shannon/package.json +++ b/lab-shannon/package.json @@ -2,14 +2,16 @@ "name": "lab-shannon", "version": "1.0.0", "description": "chat app using socket.io", - "main": "index.js", + "main": "app.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node app.js" }, "author": "shannon", "license": "MIT", "dependencies": { "express": "^4.16.2", + "http": "0.0.0", "socket.io": "^2.0.4" } } diff --git a/lab-shannon/public/index.html b/lab-shannon/public/index.html new file mode 100644 index 0000000..e191f86 --- /dev/null +++ b/lab-shannon/public/index.html @@ -0,0 +1,12 @@ + + + + + Chat App + + + + + + + diff --git a/lab-shannon/public/main.js b/lab-shannon/public/main.js new file mode 100644 index 0000000..9582ff4 --- /dev/null +++ b/lab-shannon/public/main.js @@ -0,0 +1,7 @@ +'use strict'; + +const socket = io(); + +socket.on('connection', (data) => { + console.log('groot'); +}); diff --git a/lab-shannon/public/model/chatMessage.js b/lab-shannon/public/model/chatMessage.js new file mode 100644 index 0000000..c04c878 --- /dev/null +++ b/lab-shannon/public/model/chatMessage.js @@ -0,0 +1,24 @@ +class chatMessage{ + constructor(username, message, timestamp){ + this.username = username; + this.message = message; + this.timestamp = timestamp; + } + + render(parentElement){ + let container = document.createElement('div'); + let username = document.createElement('span'); + let message = document.createElement('p'); + let timestamp = document.createElement('span'); + + username.textContent(this.username); + message.textContent(this.message); + timestamp.textContent(this.timestamp); + + container.appendChild(username); + container.appendChild(message); + container.appendChild(timestamp); + + parentElement.appendChild(container); + } +} From 7fcb2b5633798fe38a9e58e7f5ae6debf498d3d6 Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 14:49:28 -0800 Subject: [PATCH 03/10] setting up forms and eventHandling for form submission --- lab-shannon/app.js | 5 +++++ lab-shannon/public/index.html | 10 +++++++++- lab-shannon/public/main.js | 13 ++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lab-shannon/app.js b/lab-shannon/app.js index 46c7a13..ac521aa 100644 --- a/lab-shannon/app.js +++ b/lab-shannon/app.js @@ -10,8 +10,13 @@ app.use(express.static('./public')); io.on('connection', (socket) => { console.log(`${socket.id} joined`); + + socket.on('disconnect', () => { + console.log(`${socket.id} left`); + }); }); + http.listen(PORT, () => { console.log(`Listening on port: ${PORT}`); }); diff --git a/lab-shannon/public/index.html b/lab-shannon/public/index.html index e191f86..7b41b25 100644 --- a/lab-shannon/public/index.html +++ b/lab-shannon/public/index.html @@ -5,7 +5,15 @@ Chat App - +
+ + +
+
+ + +
+
diff --git a/lab-shannon/public/main.js b/lab-shannon/public/main.js index 9582ff4..cb42d15 100644 --- a/lab-shannon/public/main.js +++ b/lab-shannon/public/main.js @@ -1,7 +1,18 @@ 'use strict'; -const socket = io(); +const socket = io(); //eslint-disable-line socket.on('connection', (data) => { console.log('groot'); }); + +let usernameForm = document.getElementById('usernameForm'); +let messageForm = document.getElementById('messageForm'); + +usernameForm.addEventListener('submit', (event) => { + event.preventDefault(); +}); + +messageForm.addEventListener('submit', (event) => { + event.preventDefault(); +}); From 9c5e0428321bc05763e192e7afda0de7e28513a9 Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 16:07:10 -0800 Subject: [PATCH 04/10] messages appending to page --- lab-shannon/app.js | 9 +++++++-- lab-shannon/public/index.html | 5 +++-- lab-shannon/public/main.js | 17 +++++++++++++---- lab-shannon/public/model/chatMessage.js | 14 +++++++------- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/lab-shannon/app.js b/lab-shannon/app.js index ac521aa..9453cfd 100644 --- a/lab-shannon/app.js +++ b/lab-shannon/app.js @@ -2,18 +2,23 @@ const express = require('express'); const app = express(); -const http = require('http').createServer(app); +const http = require('http').Server(app); const io = require('socket.io')(http); const PORT = 3000; app.use(express.static('./public')); +let client = {}; io.on('connection', (socket) => { console.log(`${socket.id} joined`); - + socket.on('disconnect', () => { console.log(`${socket.id} left`); }); + + socket.on('send-message', (data) => { + io.emit('incoming-message', data); + }); }); diff --git a/lab-shannon/public/index.html b/lab-shannon/public/index.html index 7b41b25..f47db78 100644 --- a/lab-shannon/public/index.html +++ b/lab-shannon/public/index.html @@ -6,15 +6,16 @@
- +
- +
+ diff --git a/lab-shannon/public/main.js b/lab-shannon/public/main.js index cb42d15..6408a8b 100644 --- a/lab-shannon/public/main.js +++ b/lab-shannon/public/main.js @@ -2,17 +2,26 @@ const socket = io(); //eslint-disable-line -socket.on('connection', (data) => { - console.log('groot'); -}); - let usernameForm = document.getElementById('usernameForm'); +let usernameInput = document.getElementById('username'); let messageForm = document.getElementById('messageForm'); +let messageInput = document.getElementById('message'); +let messageBoard = document.getElementById('messageBoard'); usernameForm.addEventListener('submit', (event) => { event.preventDefault(); + let username = usernameInput.value; + socket.emit('set-username', {username: username}); }); messageForm.addEventListener('submit', (event) => { event.preventDefault(); + let message = messageInput.value; + socket.emit('send-message', {message: message}); +}); + +socket.on('incoming-message', (data) => { + console.log(data, `is the data`); + let newMessage = new chatMessage(data); //eslint-disable-line + newMessage.render(messageBoard); }); diff --git a/lab-shannon/public/model/chatMessage.js b/lab-shannon/public/model/chatMessage.js index c04c878..dea2cbd 100644 --- a/lab-shannon/public/model/chatMessage.js +++ b/lab-shannon/public/model/chatMessage.js @@ -1,8 +1,8 @@ class chatMessage{ - constructor(username, message, timestamp){ - this.username = username; - this.message = message; - this.timestamp = timestamp; + constructor(data){ + this.username = data.username; + this.message = data.message; + this.timestamp = data.timestamp; } render(parentElement){ @@ -11,9 +11,9 @@ class chatMessage{ let message = document.createElement('p'); let timestamp = document.createElement('span'); - username.textContent(this.username); - message.textContent(this.message); - timestamp.textContent(this.timestamp); + username.textContent = this.username; + message.textContent = this.message; + timestamp.textContent = this.timestamp; container.appendChild(username); container.appendChild(message); From c075b0c4933a4c229f5f80c088dcd821df045fd6 Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 16:30:31 -0800 Subject: [PATCH 05/10] usernames, timestamps, and messages correctly appending to DOM --- lab-shannon/app.js | 8 ++++++++ lab-shannon/public/main.js | 1 - lab-shannon/public/model/chatMessage.js | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lab-shannon/app.js b/lab-shannon/app.js index 9453cfd..e676334 100644 --- a/lab-shannon/app.js +++ b/lab-shannon/app.js @@ -11,14 +11,22 @@ let client = {}; io.on('connection', (socket) => { console.log(`${socket.id} joined`); + client[socket.id] = {}; + client[socket.id].username = ''; socket.on('disconnect', () => { console.log(`${socket.id} left`); }); socket.on('send-message', (data) => { + data.username = client[socket.id].username; + data.timestamp = new Date(); io.emit('incoming-message', data); }); + + socket.on('set-username', (data) => { + client[socket.id].username = data.username; + }); }); diff --git a/lab-shannon/public/main.js b/lab-shannon/public/main.js index 6408a8b..3e07e64 100644 --- a/lab-shannon/public/main.js +++ b/lab-shannon/public/main.js @@ -21,7 +21,6 @@ messageForm.addEventListener('submit', (event) => { }); socket.on('incoming-message', (data) => { - console.log(data, `is the data`); let newMessage = new chatMessage(data); //eslint-disable-line newMessage.render(messageBoard); }); diff --git a/lab-shannon/public/model/chatMessage.js b/lab-shannon/public/model/chatMessage.js index dea2cbd..c89c13f 100644 --- a/lab-shannon/public/model/chatMessage.js +++ b/lab-shannon/public/model/chatMessage.js @@ -8,12 +8,12 @@ class chatMessage{ render(parentElement){ let container = document.createElement('div'); let username = document.createElement('span'); - let message = document.createElement('p'); let timestamp = document.createElement('span'); + let message = document.createElement('span'); - username.textContent = this.username; - message.textContent = this.message; - timestamp.textContent = this.timestamp; + username.textContent = `${this.username}: `; + message.textContent = `${this.message} @ `; + timestamp.textContent = `${this.timestamp}`; container.appendChild(username); container.appendChild(message); From 1749d7cf78e00199b523a28c4842535916d74269 Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 16:52:39 -0800 Subject: [PATCH 06/10] add message to user telling them what their username is; clear form fields after submission --- lab-shannon/public/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lab-shannon/public/main.js b/lab-shannon/public/main.js index 3e07e64..8f690b6 100644 --- a/lab-shannon/public/main.js +++ b/lab-shannon/public/main.js @@ -11,13 +11,25 @@ let messageBoard = document.getElementById('messageBoard'); usernameForm.addEventListener('submit', (event) => { event.preventDefault(); let username = usernameInput.value; + let usernameSpace; socket.emit('set-username', {username: username}); + usernameInput.value = ''; + + if(!document.getElementById('usernameSpace')){ + usernameSpace = document.createElement('section'); + usernameSpace.setAttribute('id', 'usernameSpace'); + usernameSpace.textContent = `Your username is: ${username}`; + messageBoard.prepend(usernameSpace); + } + usernameSpace = document.getElementById('usernameSpace'); + usernameSpace.textContent = `Your username is: ${username}`; }); messageForm.addEventListener('submit', (event) => { event.preventDefault(); let message = messageInput.value; socket.emit('send-message', {message: message}); + messageInput.value = ''; }); socket.on('incoming-message', (data) => { From b6d8cdca12771252a1ade88f607c6b647b86960b Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 17:14:58 -0800 Subject: [PATCH 07/10] format date to be more readable --- lab-shannon/app.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lab-shannon/app.js b/lab-shannon/app.js index e676334..68effb4 100644 --- a/lab-shannon/app.js +++ b/lab-shannon/app.js @@ -20,7 +20,18 @@ io.on('connection', (socket) => { socket.on('send-message', (data) => { data.username = client[socket.id].username; - data.timestamp = new Date(); + let time = new Date(); + let minute = time.getMinutes(); + let hour = Math.abs(time.getHours() - 12); + let interval; + if(time.getHours() - 12 < 0){ + interval = 'am'; + }else{ + interval = 'pm'; + } + let day = time.getDate(); + let month = time.getMonth() + 1; + data.timestamp = `${hour}:${minute} ${interval} ${month}/${day}`; io.emit('incoming-message', data); }); From ad006e55f1628a3389d3773b7d672b727aefccf8 Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 17:39:16 -0800 Subject: [PATCH 08/10] set background color to full page --- lab-shannon/app.js | 2 +- lab-shannon/public/index.html | 2 ++ lab-shannon/public/style.css | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 lab-shannon/public/style.css diff --git a/lab-shannon/app.js b/lab-shannon/app.js index 68effb4..b755647 100644 --- a/lab-shannon/app.js +++ b/lab-shannon/app.js @@ -12,7 +12,7 @@ let client = {}; io.on('connection', (socket) => { console.log(`${socket.id} joined`); client[socket.id] = {}; - client[socket.id].username = ''; + client[socket.id].username = 'anonymous'; socket.on('disconnect', () => { console.log(`${socket.id} left`); diff --git a/lab-shannon/public/index.html b/lab-shannon/public/index.html index f47db78..b7441e1 100644 --- a/lab-shannon/public/index.html +++ b/lab-shannon/public/index.html @@ -3,6 +3,8 @@ Chat App + +
diff --git a/lab-shannon/public/style.css b/lab-shannon/public/style.css new file mode 100644 index 0000000..87d59b5 --- /dev/null +++ b/lab-shannon/public/style.css @@ -0,0 +1,3 @@ +body { + background: linear-gradient(to bottom, rgba(102, 255, 204, .5) 0%, rgba(255, 255, 204,.5) 100%) no-repeat center center fixed; +} From 34ae52d489e3ec14c861d227a4dd91833c69ae55 Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 17:52:30 -0800 Subject: [PATCH 09/10] bold usernames in messageboard --- lab-shannon/public/model/chatMessage.js | 1 + lab-shannon/public/style.css | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lab-shannon/public/model/chatMessage.js b/lab-shannon/public/model/chatMessage.js index c89c13f..3a05d4b 100644 --- a/lab-shannon/public/model/chatMessage.js +++ b/lab-shannon/public/model/chatMessage.js @@ -8,6 +8,7 @@ class chatMessage{ render(parentElement){ let container = document.createElement('div'); let username = document.createElement('span'); + username.setAttribute('id', 'message'); let timestamp = document.createElement('span'); let message = document.createElement('span'); diff --git a/lab-shannon/public/style.css b/lab-shannon/public/style.css index 87d59b5..3dc3e6d 100644 --- a/lab-shannon/public/style.css +++ b/lab-shannon/public/style.css @@ -1,3 +1,25 @@ body { background: linear-gradient(to bottom, rgba(102, 255, 204, .5) 0%, rgba(255, 255, 204,.5) 100%) no-repeat center center fixed; } + +#usernameForm { + position: fixed; + left: 45%; + top: 10%; +} + +#messageForm { + position: fixed; + left: 45%; + top: 15%; +} + +#messageBoard { + position: fixed; + left: 5%; + top: 20%; +} + +#message { + font-weight: bold; +} From c2f3a661a59e65176c81cdaef36e601c25b2c554 Mon Sep 17 00:00:00 2001 From: Shannon Dillon Date: Mon, 29 Jan 2018 19:41:32 -0800 Subject: [PATCH 10/10] add README --- lab-shannon/README.md | 24 ++++++++++++++++++++++++ lab-shannon/public/index.html | 2 ++ lab-shannon/public/style.css | 18 ------------------ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/lab-shannon/README.md b/lab-shannon/README.md index e69de29..fc9e03b 100644 --- a/lab-shannon/README.md +++ b/lab-shannon/README.md @@ -0,0 +1,24 @@ +## Purpose +Chat app using socket.io + +## Set Up +1. Clone the repo into whatever directory you choose +2. 'npm i' (to install all dependencies) +3. 'npm run start' to start the Server +4. go to 'http://localhost:3000/' to see it running + +## Methods + * Choose a username: saves whatever username is provided and assigns it as a property on the user object (associated with the socket id which made the connection) + * Write a message: sends a message to the public message board. + +## Technologies Used + * express + * socket.io + +## License +MIT + +## Credits +* Vinicio Vladimir Sanchez Trejo & the Code Fellows curriculum provided the base .eslintrc, .eslintignore, and .gitignore files. + +* My fellow 401JS classmates and the instructional staff for help problem solving and debugging. diff --git a/lab-shannon/public/index.html b/lab-shannon/public/index.html index b7441e1..6cfca49 100644 --- a/lab-shannon/public/index.html +++ b/lab-shannon/public/index.html @@ -7,6 +7,8 @@ +

Feeling chatty?

+

Type a message to start a conversation in the messageboard.

diff --git a/lab-shannon/public/style.css b/lab-shannon/public/style.css index 3dc3e6d..ffb79d0 100644 --- a/lab-shannon/public/style.css +++ b/lab-shannon/public/style.css @@ -2,24 +2,6 @@ body { background: linear-gradient(to bottom, rgba(102, 255, 204, .5) 0%, rgba(255, 255, 204,.5) 100%) no-repeat center center fixed; } -#usernameForm { - position: fixed; - left: 45%; - top: 10%; -} - -#messageForm { - position: fixed; - left: 45%; - top: 15%; -} - -#messageBoard { - position: fixed; - left: 5%; - top: 20%; -} - #message { font-weight: bold; }