diff --git a/data/posts.json b/data/posts.json index b4d8361..1e931e0 100644 --- a/data/posts.json +++ b/data/posts.json @@ -1,3 +1 @@ -{ - "1467390356291": "This is my very first blog post!" -} +{"1467390356291":"maria@gmail.com","1531778580603":"d@gmail.com","1531778622826":"don@gmail.com","1531864160721":"luisa@gmail.com"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..ff657da --- /dev/null +++ b/package-lock.json @@ -0,0 +1,702 @@ +{ + "name": "express-workshop", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "2.1.18", + "negotiator": "0.6.1" + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "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.3", + "iconv-lite": "0.4.19", + "on-finished": "2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "1.6.16" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "optional": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "optional": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "optional": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "optional": true + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "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" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "optional": true + }, + "define-properties": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", + "requires": { + "foreach": "2.0.5", + "object-keys": "1.0.12" + } + }, + "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=" + }, + "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.3", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", + "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "requires": { + "accepts": "1.3.5", + "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.1", + "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.3", + "qs": "6.5.1", + "range-parser": "1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "1.4.0", + "type-is": "1.6.16", + "utils-merge": "1.0.1", + "vary": "1.1.2" + } + }, + "express-formidable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/express-formidable/-/express-formidable-1.0.0.tgz", + "integrity": "sha1-3JIvBFUTIyJFip7BowHYkbP/yo0=", + "requires": { + "formidable": "1.2.1" + } + }, + "express-handlebars": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-3.0.0.tgz", + "integrity": "sha1-gKBwu4GbCeSvLKbQeA91zgXnXC8=", + "requires": { + "glob": "6.0.4", + "graceful-fs": "4.1.11", + "handlebars": "4.0.11", + "object.assign": "4.1.0", + "promise": "7.3.1" + } + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "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.4.0", + "unpipe": "1.0.0" + } + }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" + }, + "formidable": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz", + "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg==" + }, + "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=" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "handlebars": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" + } + }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": "1.4.0" + } + }, + "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==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", + "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "optional": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" + }, + "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.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "requires": { + "mime-db": "1.33.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" + }, + "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-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "requires": { + "define-properties": "1.1.2", + "function-bind": "1.1.1", + "has-symbols": "1.0.0", + "object-keys": "1.0.12" + } + }, + "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" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1.0.2" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "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=" + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "requires": { + "asap": "2.0.6" + } + }, + "proxy-addr": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", + "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", + "requires": { + "forwarded": "0.1.2", + "ipaddr.js": "1.6.0" + } + }, + "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" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + }, + "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.4.0" + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + } + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "optional": true, + "requires": { + "align-text": "0.1.4" + } + }, + "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.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "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.3", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "2.3.0", + "range-parser": "1.2.0", + "statuses": "1.4.0" + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "parseurl": "1.3.2", + "send": "0.16.2" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "requires": { + "amdefine": "1.0.1" + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "2.1.18" + } + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "optional": true, + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "optional": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "optional": true + }, + "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=" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "optional": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..5de3b45 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "express-workshop", + "version": "1.0.0", + "description": "This is the exercise that accompanies the first Node class. Based on the Node Girls Workshop https://github.com/node-girls/express-workshop", + "main": "server.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/franciscavargas/express-workshop.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/franciscavargas/express-workshop/issues" + }, + "homepage": "https://github.com/franciscavargas/express-workshop#readme", + "dependencies": { + "express": "^4.16.3", + "express-formidable": "^1.0.0", + "express-handlebars": "^3.0.0" + } +} diff --git a/public/README.md b/public/README.md new file mode 100755 index 0000000..9400959 --- /dev/null +++ b/public/README.md @@ -0,0 +1 @@ +# tribute-page \ No newline at end of file diff --git a/public/css/style-subscribe.css b/public/css/style-subscribe.css new file mode 100644 index 0000000..a4b05b6 --- /dev/null +++ b/public/css/style-subscribe.css @@ -0,0 +1,37 @@ +/* Style the form element with a border around it */ +form { + border: 4px solid #f1f1f1; +} + +/* Add some padding and a grey background color to containers */ +.container { + padding: 20px; + background-color: #f1f1f1; +} + +/* Style the input elements and the submit button */ +input[type="text"], +input[type="submit"] { + width: 100%; + padding: 12px; + margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + box-sizing: border-box; +} + +/* Add margins to the checkbox */ +input[type="checkbox"] { + margin-top: 16px; +} + +/* Style the submit button */ +input[type="submit"] { + background-color: #4caf50; + color: white; + border: none; +} + +input[type="submit"]:hover { + opacity: 0.8; +} diff --git a/public/css/style.css b/public/css/style.css new file mode 100755 index 0000000..b19cc93 --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,290 @@ +/* LEGACY BROWSERS */ +section, article, aside, footer, header, nav { + display: block; +} + +@import url('https://fonts.googleapis.com/css?family=Playfair+Display:400,700|Roboto:400,400i,700'); + +body { + background-color: rgb(255, 255, 255); + font-family: 'Roboto' , sans-serif; + line-height: 1.5rem; + margin: 0; +} + +section { + align-items: baseline; + display: flex; + flex-direction: row; + justify-content: center; + overflow-x: hidden; + padding: 6rem; +} + +article { + width: 100%; +} + +aside { + background-color: rgb(255, 255, 255); + border-radius: 4px; + box-shadow: 1px 10px 50px 10px rgba(0,0,0,0.075); + font-size: 0.8rem; + margin-left: 100px; + padding: 1rem 2rem; + width: 40%; +} + +nav , footer { + align-items: center; + background-color: rgba(47,47,47,0.98); + display: flex; + justify-content: center; + min-height: 50px; + width: 100%; +} + +footer { + color: rgb(153, 153, 153); +} + +nav { + box-shadow: 0 1px 3px rgba(0,0,0,0.2); + position: fixed; + top: 0; +} + +figure { + margin: 0; +} + +h1, h3, h4, h5, h6 { + font-family: 'Playfair Display', serif; + font-weight: 300; + line-height: 1.2; +} + +h1 , h2 { + color: rgb(255, 255, 255); + margin-right: 4%; + text-align: right; + text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.4); +} + +h1 { + font-size: 4rem; +} + +h2 { + font-size: 1.5rem; + letter-spacing: 2px; + line-height: 1.2; +} + +h3 { + font-size: 3rem; +} + +h4 { + font-size: 1.5rem; +} + +h6 { + font-size: 0.8rem; + letter-spacing: 1px; + text-transform: uppercase; +} + +/* Navbar */ + +nav > a , nav > p { + background-color: transparent; + text-decoration: none; +} + +nav > a { + color: rgb(153, 153, 153); + padding: 10px 20px; +} + +nav > a:hover { + color: rgba(255, 255, 255, 0.8); +} + +nav > p { + color: rgba(255, 255, 255, 0.8); + letter-spacing: 2px; + padding: 0 20px; +} + +.hero { + background-size: cover; + height: calc(100vh - 56px); + width: 100%; +} + +/*Section - Hero Cover */ + +.hero.cover { + background-image: url('https://cdn5.kicksonfire.com/wp-content/uploads/2017/02/Serena-Williams.jpg?x76107'); + background-position: top center; + background-size: cover; + display: flex; + flex-direction: column; + justify-content: center; + margin-top: 56px; +} + +/*Section - Intro */ + +section.intro , section.playing , section.off-court{ + background-color: #eee; +} + +section > article.intro { + width: 70%; +} + +/* Section - Facts */ + +section.facts li { + margin-bottom: 1.2rem; +} + +section.facts span { + font-weight: bold; +} + +/* Section - Visuals */ +figure.visuals { + margin: 0; + max-height: calc(100vh - 56); + overflow-y: hidden; +} + +figure.visuals img { + height: auto; + vertical-align: bottom; + width: 100%; +} + +/* Section - Career */ +.career h3 { + text-align: center; +} + +section.career table { + box-shadow: -8px 10px 36px 5px rgba(59,70,78,0.15); + margin: 0 auto; + width: 80%; +} + +section.career table { + box-shadow: -8px 10px 36px 5px rgba(59,70,78,0.15); + margin: 0 auto; + padding: 2rem; + width: 70%; +} + +.career table thead { + margin-bottom: 0.5rem; + text-align: center; +} + +.career th, td { + padding: 0.5rem; +} + +.total-slam { + background-color: rgb(102, 103, 126); + color: rgb(255, 255, 255); +} + +.career table thead , .total-category { + background-color: rgb(56, 59, 83); + color: rgb(255, 255, 255); +} + +/* Emoji */ + +figure.emoji { + animation: emoji 1.5s ease infinite; + bottom: 10px; + position: fixed; + right: 10px; +} + +figure.emoji:hover { + animation-play-state: paused; + opacity: 0.5; +} + +@keyframes emoji { + 30% { transform: scale(1.1); } + 40%, 60% { transform: rotate(-20deg) scale(1.1); } + 50% { transform: rotate(20deg) scale(1.1); } + 70% { transform: rotate(0deg) scale(1.1); } + 100% { transform: scale(1); } +} + +figure.emoji img { + max-width: 90px; +} + +/* Source */ + +div.source { + padding: 6rem; + text-align: center; +} + +/* MEDIA QUERIES */ +@media screen and (min-width: 1600px) { + section.career table { + max-width: 50%; + } +} + +@media screen and (max-width: 768px) and (orientation: portrait), (max-width: 768px){ + nav { + flex-wrap: wrap; + justify-content: space-around; + text-align: center; + } + + section.intro { + flex-wrap: wrap; + justify-content: space-around; + } + + aside { + width: 100%; + margin-left: 0; + margin-top: 2rem; + } + + section.career { + padding: 3rem; + } + + section.career table { + padding: 0; + max-width: 70%; + width: inherit; + font-size: 0.8rem; + } +} + +@media screen and (max-width: 480px) { + section { + padding: 3rem; + } + + section.career { + padding: 1rem; + } + + section.career table { + font-size: 0.6rem; + } +} diff --git a/public/img/logo1.png b/public/img/logo1.png deleted file mode 100644 index 341a802..0000000 Binary files a/public/img/logo1.png and /dev/null differ diff --git a/public/img/logo2.png b/public/img/logo2.png deleted file mode 100644 index f4f0b62..0000000 Binary files a/public/img/logo2.png and /dev/null differ diff --git a/public/index.html b/public/index.html old mode 100644 new mode 100755 index 859031c..a0cc057 --- a/public/index.html +++ b/public/index.html @@ -1,31 +1,418 @@ - - - - My first Node.js blog! - - - - -
- -

Node Girls

+ + + + Tribute page + + + + + + + + + + + + + + + + Serena Wiliams - Tribute page + + + + + +
+

Serena Williams

+

The Greatest Female Tennis Player of All Time

+
+ + +
+
+
+

Intro

+
+ +

Serena Jameka Williams + (born September 26, 1981) is an American professional tennis player. + The Women's Tennis Association (WTA) has ranked her world No. 1 in singles on eight separate occasions over the + last 15 years from 2002 to 2017. +

+

Williams holds the most Grand Slam titles in singles, doubles, and mixed doubles combined amongst active players. + She is the most recent female player to have held all four Grand Slam singles titles simultaneously (2002–03 and + 2014–15) and all four Grand Slam women's doubles titles simultaneously (2009–10).

+
+ + +
+ + +
+
+
+

Professional and Life Facts

+
+ +
    +
  • + September 1995 - Turns professional, losing her debut tennis match at the Bell Challenge in Quebec.
  • +
  • + January 1998 - Enters the Australian Open, her first Grand Slam tournament. She loses to her sister, Venus, + in the second round, 6-7, 1-6.
  • +
  • + 1999 - Enrolls at the Art Institute of Fort Lauderdale in Florida for fashion design.
  • +
  • + September 12, 1999 - Wins the US Open, becoming the first Williams sister to win a Grand Slam.
  • +
  • + July 8, 2002 - Ranked Women's Tennis Association (WTA) world number 1 for the first time in her career, + at age 20.
  • +
  • + 2002-2003 - Completes her first "Serena Slam," by winning all four Grand Slam titles - the French Open, + Wimbledon, US Open and the Australian Open.
  • +
  • + August 1, 2003 - Has surgery to repair a partially torn tendon in her left knee.
  • +
  • + September 14, 2003 - Williams' older half-sister, Yetunde Price, is murdered in Compton, California.
  • +
  • + 2004 - Launches "Aneres" clothing line (Serena spelled backwards).
  • +
  • + 2008 - Establishes the Serena Williams Foundation, to assist American youth touched by violent crime and + also underprivileged children around the world.
  • +
  • + September 12, 2009 - Williams goes on a profanity-laced outburst against a line judge who calls her for + a foot fault in the US Open semifinals against Kim Clijsters. Clijsters is awarded a penalty point to win the + match. The Grand Slam committee later fines Williams a record $82,500 and places her on probation for the next + two years.
  • +
  • + July 7, 2010 - Receives stitches in both her feet after stepping on broken glass while leaving a restaurant + in Munich. Later, she has to have surgeries in July and October to repair a lacerated tendon on her right foot.
  • +
  • + February 2011 - Undergoes emergency treatment for a hematoma related to a pulmonary embolism, a blood + clot in her lungs.
  • +
  • + September 2011 - Appointed a UNICEF international goodwill ambassador.
  • +
  • + February 18, 2013 - At age 31, becomes the oldest female tennis player to be ranked number 1 since computer + rankings began in 1975. This is the sixth time in her career to be ranked number one.
  • +
  • + September 7, 2014 - Williams wins her third consecutive US Open title.
  • +
  • + July 9, 2016span> - Wins the Wimbledon title for the 7th time. With her 22nd victory in a major tournament, + Williams ties Steffi Graf for most singles titles in the Open era
  • +
  • + September 12, 2016 - After 186 consecutive weeks ranked Women's Tennis Association (WTA) No. 1 in the + world, falls to No. 2 behind Angelique Kerber. Williams ties Steffi Graf's record for longest consecutive weeks + ranked No. 1.
  • +
  • December 29, 2016 - Announces her engagement to Reddit co-founder Alexis Ohanian.
  • +
  • + January 28, 2017 - Beats sister Venus in the Australian Open final, collecting a 23rd grand slam title + to surpass Steffi Graf for the Open Era lead.
  • +
  • + April 19, 2017 - Williams posts a side profile photo of herself in a yellow swimsuit with a caption that + reads "20 weeks" on Snapchat, that is quickly deleted. Her spokesperson later confirms to CNN that Williams and + fiancΓ© Alexis Ohanian are expecting their first child this fall.
  • +
  • + September 1, 2017 - Gives birth to a baby girl, Alexis Olympia Ohanian Jr.
  • +
+
+
+ +
+ Serena Williams playing tennis +
+ +
+
+
+

Playing Style

+
+ +

Williams is primarily a baseline player, and her game is built around taking immediate control of rallies with her + powerful and consistent serve, return of serve, and forceful groundstrokes from both her forehand and backhand + swings. Williams's forehand is considered to be among the most powerful shots in the women's game, as is her double-handed + backhand. Williams strikes her backhand groundstroke using an open stance, and uses the same open stance for her + forehand. Williams's aggressive play, a "high risk" style, is balanced in part by her serve, which most say is + the greatest in women's tennis history.

+

Williams is known for producing exceptional comebacks, particularly on the Grand Slam level. Williams has bounced + back from a set down to win in 37 Grand Slam matches.

+

She has stated that her favorite surface is clay because it gives her extra time to set up her shots.

+ +
+
+ +
+
+
+

Career Statistics

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Career finals
DisciplineTypeWonLostTotalWR
SinglesGrand Slam236290.79
Summer Olympics1–11.00
WTA Tour Championships5270.71
Grand Slam Cup1-11.00
WTA Premier Mandatory & 5239320.71
WTA Tour193220.86
Total7220920.78
DoublesGrand Slam14–141.00
Summer Olympics3–31.00
WTA Tour Championships––––
WTA Premier Mandatory & 52–21.00
WTA Tour4150.80
Total231240.96
Mixed doublesGrand Slam2240.50
Total2240.50
Team competitionsFed Cup1120.50
Hopman Cup2130.67
Total3250.60
Total100251250.80
+ 1) WR = winning rate +
+
+
+ +
+ Serena Williams artistic pose with black bodysuit +
+ +
+
+
+

Off-court Activities

-
-
- -
- -
-
-
- -

Recent Posts

- -
-
- - - - + +

Equipment and endorsements

+

In the early 2000s, Williams wore Puma apparel and footwear on court. She used the Wilson Hammer 6.4 Stretch Power + Holes racquet. Today, she is endorsed by Nike and uses the Wilson Blade 104. Williams also has endorsement deals + with Gatorade, Delta Air Lines, Audemars Piguet, Aston Martin, Pepsi, Beats by Dre headphones, Mission Athletecare, + Berlei bras, OPI Products, OnePiece, IBM, Mini, Intel, Tempur and Chase Bank.

+

Williams is the current CSO (Chief Sporting Officer) for British luxury automobile manufacturer Aston Martin.

+
+ +

Fashion

+

Williams formerly had a special line with Puma. In April 2004, she signed a deal worth US$40 million for a line with + Nike. +

+

In 2015, she became the first black female athlete to have a picture by herself on the cover of Vogue, which she + did for the April 2015 issue.

+
+ +

Charity Work

+

As part of the Serena Williams Foundation's work, Williams helped to fund the construction of the Serena Williams + Secondary School in Matooni, Kenya. The Serena Williams Foundation also provides university scholarships for underprivileged + students in the United States. Serena, along with her sister Venus, is a supporter and contributor of First Serve + Miami, a foundation for youth who want to learn tennis but are socially and economically challenged. She has been + an International Goodwill Ambassador with UNICEF since 2011 and has helped launch UNICEF's Schools for Asia campaign.

+

In 2014, Williams began hosting an annual charity run named "The Serena Williams Ultimate Fun Run". The event helps + underprivileged individuals and communities that are affected by senseless violence and to ensure equal access + to education of youth.

+
+
+
+ +
+

+ Source: + Serena Williams Wikipedia page & + CNN - Serena Fast Facts + +

+

+ Last Updated: + + +

+
+ +
+ + Serena Williams with a racket + +
+ + + + + + + \ No newline at end of file diff --git a/public/main.css b/public/main.css deleted file mode 100644 index 18a4da3..0000000 --- a/public/main.css +++ /dev/null @@ -1,147 +0,0 @@ -/******************* -* Basic Resets -********************/ - -body, html, div, label, p, h1, h2, h3, h4, h5, h6, form, a, input, textarea { - margin: 0; - padding: 0; - border: 0; - outline: none; -} - - -body { - line-height: 1; - font-size: 88%; - font-family: 'Open Sans', arial, sans-serif; - background: #FAFAFA; - color: #585858; -} - -div { - width: 100%; -} - - -h1, h2, h3, h4, h5, h6 { - font-size: 100%; - padding: 23px 0; - margin: 0 15px; - color: #FF0040; - letter-spacing: 1px; -} - -h1 { - font-size: 32px; -} - -h2 { - font-size: 25px; -} - -main { - display: block; - width: 80%; - margin: 0 auto; -} - -/******************* -* Header -********************/ - - -header { - background: #FF0040; - background: -webkit-linear-gradient(#F5A9BC, #FF0040); - background: -o-linear-gradient(#F5A9BC, #FF0040); - background: -moz-linear-gradient(#F5A9BC, #FF0040); - background: linear-gradient(#F5A9BC, #FF0040); -} - -.title { - color: white; -} - -.main-logo { - float: left; - width: 100px; - height: auto; -} - - -/******************* -* Enter a New Post -********************/ - -.entry-container { - margin: 20px 0 50px; -} - -label { - width: 100%; -} - -.text-wrapper { - width: 80%; -} - -textarea { - width: 96%; - border-radius: 3px; - border: 1px solid #848484; - padding: 5px 2%; -} - -button[type="submit"] { - background: #A5DF00; - background: -webkit-linear-gradient(#93C503, #ABCC4B); - background: -o-linear-gradient(#93C503, #ABCC4B); - background: -moz-linear-gradient(#93C503, #ABCC4B); - background: linear-gradient(#93C503, #ABCC4B); - border: none; - color: white; - padding: 4px 25px; - text-transform: uppercase; - letter-spacing: 1px; - float: right; - margin-top: 10px; - border-radius: 3px; -} - -/******************* -* Posts -********************/ - -hr { - background: #BDBDBD; -} - -.thumbnail { - float: left; - width: 50px; - height: auto; - margin-left: 3px; - margin-top: 3px; -} - -.post { - width: 100%; - border: 1px solid #848484; - float: left; - margin: 2%; - border-radius: 3px; - -webkit-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); - -moz-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); - box-shadow: 3px 3px 3px 0px rgba(50, 50, 50, 0.4); - background: white; -} - -.post p { - margin: 5px 10px; -} - -@media (min-width: 600px) { - .post { - width: 28.9%; - } -} \ No newline at end of file diff --git a/public/script.js b/public/script.js deleted file mode 100644 index b677186..0000000 --- a/public/script.js +++ /dev/null @@ -1,78 +0,0 @@ -if (document.readyState !== 'loading') { - ready(); -} else { - document.addEventListener('DOMContentLoaded', ready); -} - -function ready () { - getBlogposts('/get-posts'); - - // send posts to server - var form = document.querySelector('form'); - form.addEventListener('submit', function (event) { - - event.preventDefault(); // prevents the form from contacting our server automatically (we want to do it ourselves) - var formActionUrl = form.action; // 'form.action' is the url '/create-post' - var formData = new FormData(form); - - postBlogposts(formActionUrl, formData); - }); -} - -/**** - * Function definitions - ***/ -function postBlogposts (url, data) { - fetch(url, { - method: 'POST', - body: data - }) - .then(function (res) { - res.json() - .then(function (json) { - console.log(json); - addBlogpostsToPage(json); - document.querySelector('form').reset(); - }) - }) - .catch(function (err) { - console.error(err) - }); -} - -function getBlogposts (url) { - fetch(url, { - method: 'GET' - }) - .then(function (res) { - res.json() - .then(function (json) { - console.log(json); - addBlogpostsToPage(json); - }); - }) - .catch(function (err) { - console.error(err) - }); -} - -function addBlogpostsToPage (data) { - for (var blogpost in data) { - if (data.hasOwnProperty(blogpost)) { - - var postDiv = document.createElement('div'); - var postText = document.createElement('p'); - var thumbnail = document.createElement('img'); - var postContainer = document.querySelector('.post-container'); - - thumbnail.src = "./img/logo2.png"; - thumbnail.className = "thumbnail"; - postText.innerHTML = data[blogpost]; - postDiv.className = "post"; - - postDiv.appendChild(thumbnail); - postDiv.appendChild(postText); - postContainer.appendChild(postDiv); - } - } -} diff --git a/public/subscribe.html b/public/subscribe.html new file mode 100644 index 0000000..a0dc911 --- /dev/null +++ b/public/subscribe.html @@ -0,0 +1,45 @@ + + + + + + Contact Form + + + + + + + + + + + + + + Serena Wiliams - Tribute page + + + +
+
+

Subscribe to our Newsletter

+

Lorem ipsum..

+
+ +
+ + + +
+ +
+ +
+
+ + + + \ No newline at end of file diff --git a/server.js b/server.js new file mode 100644 index 0000000..0fffd5c --- /dev/null +++ b/server.js @@ -0,0 +1,64 @@ +const exphbs = require("express-handlebars"); +const fs = require("fs"); +const express = require("express"); +const app = express(); +const formidable = require("express-formidable"); + +app.use(express.static("public")); +app.use(formidable()); + +app.set("views", __dirname + "/views"); +app.engine("handlebars", exphbs({ defaultLayout: "main" })); +app.set("view engine", "handlebars"); + +app.post("/subscribe", function(req, res) { + var email = req.fields.mail; + + fs.readFile(__dirname + "/data/posts.json", function(error, content) { + //Convert the text in JSON to an object + var mailingList = JSON.parse(content); + + // Adding the content to the object + var date = Date.now(); + mailingList[date] = email; + + // Convert the object to string in JSON format + var newContent = JSON.stringify(mailingList); + + // Write the file with the whole new content + fs.writeFile(__dirname + "/data/posts.json", newContent, function(error) { + res.end("success!"); + }); + }); +}); + +app.get("/subscribers", function(req, res) { + // Read file + fs.readFile(__dirname + "/data/posts.json", function(error, content) { + //Convert the text in JSON to an object + var mailingList = JSON.parse(content); + + //Convert the object in an array with the emails + var emails = Object.keys(mailingList).map(function(key) { + return mailingList[key]; + }); + + console.log(emails); + + // array emails to handlebars + res.render("subscribers", { + subscribersMail: emails + }); + }); +}); + +app.get("*", function(req, res) { + console.log("404 at " + Date()); + res.writeHead(404, { "Content-Type": "text/html" }); + res.write("NOT FOUND!!!"); + res.end(); +}); + +app.listen(5000, function() { + console.log("Server is listening on port 5000. Ready to accept requests!"); +}); diff --git a/views/layouts/main.handlebars b/views/layouts/main.handlebars new file mode 100644 index 0000000..8c4e1e1 --- /dev/null +++ b/views/layouts/main.handlebars @@ -0,0 +1,15 @@ + + + + + + + The HTML5 Herald + + + + + {{{body}}} + + + \ No newline at end of file diff --git a/views/subscribers.handlebars b/views/subscribers.handlebars new file mode 100644 index 0000000..75c637c --- /dev/null +++ b/views/subscribers.handlebars @@ -0,0 +1,8 @@ +

Subscribers - Mailing List

+ + \ No newline at end of file