- Timestamp:
- 08/30/22 14:13:43 (2 years ago)
- Branches:
- master
- Children:
- 16237c4
- Parents:
- b612ab1
- Location:
- backend
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
backend/data.js
rb612ab1 r717ceae 1 import bcrypt from "bcryptjs"; 2 1 3 const data = { 4 users: [ 5 { 6 name: "Nace", 7 email: "nace@example.com", 8 password: bcrypt.hashSync("123456"), 9 isAdmin: true, 10 }, 11 { 12 name: "tester1", 13 email: "tester@example.com", 14 password: bcrypt.hashSync("123456"), 15 isAdmin: false, 16 }, 17 ], 2 18 products: [ 3 19 { 4 _id: "1",20 //_id: "1", 5 21 name: "Арин", 6 22 slug: "gejmerski-stol-arin", … … 18 34 }, 19 35 { 20 _id: "2",36 //_id: "2", 21 37 name: "Торин", 22 38 slug: "gejmerski-stol-torin", -
backend/package-lock.json
rb612ab1 r717ceae 10 10 "license": "ISC", 11 11 "dependencies": { 12 "express": "^4.18.1" 12 "bcryptjs": "^2.4.3", 13 "dotenv": "^16.0.1", 14 "express": "^4.18.1", 15 "mongoose": "^6.5.3" 13 16 }, 14 17 "devDependencies": { 15 18 "nodemon": "^2.0.19" 19 } 20 }, 21 "node_modules/@types/node": { 22 "version": "18.7.13", 23 "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.13.tgz", 24 "integrity": "sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==" 25 }, 26 "node_modules/@types/webidl-conversions": { 27 "version": "6.1.1", 28 "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", 29 "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" 30 }, 31 "node_modules/@types/whatwg-url": { 32 "version": "8.2.2", 33 "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", 34 "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", 35 "dependencies": { 36 "@types/node": "*", 37 "@types/webidl-conversions": "*" 16 38 } 17 39 }, … … 57 79 "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", 58 80 "dev": true 81 }, 82 "node_modules/base64-js": { 83 "version": "1.5.1", 84 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", 85 "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", 86 "funding": [ 87 { 88 "type": "github", 89 "url": "https://github.com/sponsors/feross" 90 }, 91 { 92 "type": "patreon", 93 "url": "https://www.patreon.com/feross" 94 }, 95 { 96 "type": "consulting", 97 "url": "https://feross.org/support" 98 } 99 ] 100 }, 101 "node_modules/bcryptjs": { 102 "version": "2.4.3", 103 "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", 104 "integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==" 59 105 }, 60 106 "node_modules/binary-extensions": { … … 112 158 } 113 159 }, 160 "node_modules/bson": { 161 "version": "4.7.0", 162 "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.0.tgz", 163 "integrity": "sha512-VrlEE4vuiO1WTpfof4VmaVolCVYkYTgB9iWgYNOrVlnifpME/06fhFRmONgBhClD5pFC1t9ZWqFUQEQAzY43bA==", 164 "dependencies": { 165 "buffer": "^5.6.0" 166 }, 167 "engines": { 168 "node": ">=6.9.0" 169 } 170 }, 171 "node_modules/buffer": { 172 "version": "5.7.1", 173 "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", 174 "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", 175 "funding": [ 176 { 177 "type": "github", 178 "url": "https://github.com/sponsors/feross" 179 }, 180 { 181 "type": "patreon", 182 "url": "https://www.patreon.com/feross" 183 }, 184 { 185 "type": "consulting", 186 "url": "https://feross.org/support" 187 } 188 ], 189 "dependencies": { 190 "base64-js": "^1.3.1", 191 "ieee754": "^1.1.13" 192 } 193 }, 114 194 "node_modules/bytes": { 115 195 "version": "3.1.2", … … 205 285 } 206 286 }, 287 "node_modules/denque": { 288 "version": "2.1.0", 289 "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", 290 "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", 291 "engines": { 292 "node": ">=0.10" 293 } 294 }, 207 295 "node_modules/depd": { 208 296 "version": "2.0.0", … … 220 308 "node": ">= 0.8", 221 309 "npm": "1.2.8000 || >= 1.4.16" 310 } 311 }, 312 "node_modules/dotenv": { 313 "version": "16.0.1", 314 "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", 315 "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==", 316 "engines": { 317 "node": ">=12" 222 318 } 223 319 }, … … 435 531 } 436 532 }, 533 "node_modules/ieee754": { 534 "version": "1.2.1", 535 "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", 536 "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", 537 "funding": [ 538 { 539 "type": "github", 540 "url": "https://github.com/sponsors/feross" 541 }, 542 { 543 "type": "patreon", 544 "url": "https://www.patreon.com/feross" 545 }, 546 { 547 "type": "consulting", 548 "url": "https://feross.org/support" 549 } 550 ] 551 }, 437 552 "node_modules/ignore-by-default": { 438 553 "version": "1.0.1", … … 446 561 "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 447 562 }, 563 "node_modules/ip": { 564 "version": "2.0.0", 565 "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", 566 "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" 567 }, 448 568 "node_modules/ipaddr.js": { 449 569 "version": "1.9.1", … … 496 616 } 497 617 }, 618 "node_modules/kareem": { 619 "version": "2.4.1", 620 "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz", 621 "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==" 622 }, 498 623 "node_modules/media-typer": { 499 624 "version": "0.3.0", … … 503 628 "node": ">= 0.6" 504 629 } 630 }, 631 "node_modules/memory-pager": { 632 "version": "1.5.0", 633 "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", 634 "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", 635 "optional": true 505 636 }, 506 637 "node_modules/merge-descriptors": { … … 558 689 "node": "*" 559 690 } 691 }, 692 "node_modules/mongodb": { 693 "version": "4.8.1", 694 "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", 695 "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", 696 "dependencies": { 697 "bson": "^4.6.5", 698 "denque": "^2.0.1", 699 "mongodb-connection-string-url": "^2.5.2", 700 "socks": "^2.6.2" 701 }, 702 "engines": { 703 "node": ">=12.9.0" 704 }, 705 "optionalDependencies": { 706 "saslprep": "^1.0.3" 707 } 708 }, 709 "node_modules/mongodb-connection-string-url": { 710 "version": "2.5.3", 711 "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", 712 "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", 713 "dependencies": { 714 "@types/whatwg-url": "^8.2.1", 715 "whatwg-url": "^11.0.0" 716 } 717 }, 718 "node_modules/mongoose": { 719 "version": "6.5.3", 720 "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.5.3.tgz", 721 "integrity": "sha512-0L2ZOPzNQ7kcIgpdfpmVXc+/SypdhzcTlaHXYa983u1lrVp7/i3ekwHpPiTXxYBvV6FwBAsFoHI7+Ovf8tp3Mg==", 722 "dependencies": { 723 "bson": "^4.6.5", 724 "kareem": "2.4.1", 725 "mongodb": "4.8.1", 726 "mpath": "0.9.0", 727 "mquery": "4.0.3", 728 "ms": "2.1.3", 729 "sift": "16.0.0" 730 }, 731 "engines": { 732 "node": ">=12.0.0" 733 }, 734 "funding": { 735 "type": "opencollective", 736 "url": "https://opencollective.com/mongoose" 737 } 738 }, 739 "node_modules/mongoose/node_modules/ms": { 740 "version": "2.1.3", 741 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 742 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 743 }, 744 "node_modules/mpath": { 745 "version": "0.9.0", 746 "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", 747 "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", 748 "engines": { 749 "node": ">=4.0.0" 750 } 751 }, 752 "node_modules/mquery": { 753 "version": "4.0.3", 754 "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz", 755 "integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==", 756 "dependencies": { 757 "debug": "4.x" 758 }, 759 "engines": { 760 "node": ">=12.0.0" 761 } 762 }, 763 "node_modules/mquery/node_modules/debug": { 764 "version": "4.3.4", 765 "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 766 "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 767 "dependencies": { 768 "ms": "2.1.2" 769 }, 770 "engines": { 771 "node": ">=6.0" 772 }, 773 "peerDependenciesMeta": { 774 "supports-color": { 775 "optional": true 776 } 777 } 778 }, 779 "node_modules/mquery/node_modules/ms": { 780 "version": "2.1.2", 781 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 782 "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 560 783 }, 561 784 "node_modules/ms": { … … 701 924 "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", 702 925 "dev": true 926 }, 927 "node_modules/punycode": { 928 "version": "2.1.1", 929 "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 930 "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", 931 "engines": { 932 "node": ">=6" 933 } 703 934 }, 704 935 "node_modules/qs": { … … 774 1005 "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 775 1006 }, 1007 "node_modules/saslprep": { 1008 "version": "1.0.3", 1009 "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", 1010 "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", 1011 "optional": true, 1012 "dependencies": { 1013 "sparse-bitfield": "^3.0.3" 1014 }, 1015 "engines": { 1016 "node": ">=6" 1017 } 1018 }, 776 1019 "node_modules/semver": { 777 1020 "version": "5.7.1", … … 843 1086 } 844 1087 }, 1088 "node_modules/sift": { 1089 "version": "16.0.0", 1090 "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", 1091 "integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==" 1092 }, 845 1093 "node_modules/simple-update-notifier": { 846 1094 "version": "1.0.7", … … 864 1112 } 865 1113 }, 1114 "node_modules/smart-buffer": { 1115 "version": "4.2.0", 1116 "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", 1117 "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", 1118 "engines": { 1119 "node": ">= 6.0.0", 1120 "npm": ">= 3.0.0" 1121 } 1122 }, 1123 "node_modules/socks": { 1124 "version": "2.7.0", 1125 "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", 1126 "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", 1127 "dependencies": { 1128 "ip": "^2.0.0", 1129 "smart-buffer": "^4.2.0" 1130 }, 1131 "engines": { 1132 "node": ">= 10.13.0", 1133 "npm": ">= 3.0.0" 1134 } 1135 }, 1136 "node_modules/sparse-bitfield": { 1137 "version": "3.0.3", 1138 "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", 1139 "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", 1140 "optional": true, 1141 "dependencies": { 1142 "memory-pager": "^1.0.2" 1143 } 1144 }, 866 1145 "node_modules/statuses": { 867 1146 "version": "2.0.1", … … 914 1193 "bin": { 915 1194 "nodetouch": "bin/nodetouch.js" 1195 } 1196 }, 1197 "node_modules/tr46": { 1198 "version": "3.0.0", 1199 "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", 1200 "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", 1201 "dependencies": { 1202 "punycode": "^2.1.1" 1203 }, 1204 "engines": { 1205 "node": ">=12" 916 1206 } 917 1207 }, … … 957 1247 "node": ">= 0.8" 958 1248 } 1249 }, 1250 "node_modules/webidl-conversions": { 1251 "version": "7.0.0", 1252 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", 1253 "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", 1254 "engines": { 1255 "node": ">=12" 1256 } 1257 }, 1258 "node_modules/whatwg-url": { 1259 "version": "11.0.0", 1260 "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", 1261 "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", 1262 "dependencies": { 1263 "tr46": "^3.0.0", 1264 "webidl-conversions": "^7.0.0" 1265 }, 1266 "engines": { 1267 "node": ">=12" 1268 } 959 1269 } 960 1270 }, 961 1271 "dependencies": { 1272 "@types/node": { 1273 "version": "18.7.13", 1274 "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.13.tgz", 1275 "integrity": "sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==" 1276 }, 1277 "@types/webidl-conversions": { 1278 "version": "6.1.1", 1279 "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", 1280 "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==" 1281 }, 1282 "@types/whatwg-url": { 1283 "version": "8.2.2", 1284 "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", 1285 "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", 1286 "requires": { 1287 "@types/node": "*", 1288 "@types/webidl-conversions": "*" 1289 } 1290 }, 962 1291 "abbrev": { 963 1292 "version": "1.1.1", … … 995 1324 "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", 996 1325 "dev": true 1326 }, 1327 "base64-js": { 1328 "version": "1.5.1", 1329 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", 1330 "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" 1331 }, 1332 "bcryptjs": { 1333 "version": "2.4.3", 1334 "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", 1335 "integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==" 997 1336 }, 998 1337 "binary-extensions": { … … 1040 1379 } 1041 1380 }, 1381 "bson": { 1382 "version": "4.7.0", 1383 "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.0.tgz", 1384 "integrity": "sha512-VrlEE4vuiO1WTpfof4VmaVolCVYkYTgB9iWgYNOrVlnifpME/06fhFRmONgBhClD5pFC1t9ZWqFUQEQAzY43bA==", 1385 "requires": { 1386 "buffer": "^5.6.0" 1387 } 1388 }, 1389 "buffer": { 1390 "version": "5.7.1", 1391 "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", 1392 "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", 1393 "requires": { 1394 "base64-js": "^1.3.1", 1395 "ieee754": "^1.1.13" 1396 } 1397 }, 1042 1398 "bytes": { 1043 1399 "version": "3.1.2", … … 1107 1463 } 1108 1464 }, 1465 "denque": { 1466 "version": "2.1.0", 1467 "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", 1468 "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==" 1469 }, 1109 1470 "depd": { 1110 1471 "version": "2.0.0", … … 1116 1477 "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", 1117 1478 "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" 1479 }, 1480 "dotenv": { 1481 "version": "16.0.1", 1482 "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", 1483 "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==" 1118 1484 }, 1119 1485 "ee-first": { … … 1278 1644 } 1279 1645 }, 1646 "ieee754": { 1647 "version": "1.2.1", 1648 "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", 1649 "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" 1650 }, 1280 1651 "ignore-by-default": { 1281 1652 "version": "1.0.1", … … 1289 1660 "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 1290 1661 }, 1662 "ip": { 1663 "version": "2.0.0", 1664 "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", 1665 "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" 1666 }, 1291 1667 "ipaddr.js": { 1292 1668 "version": "1.9.1", … … 1324 1700 "dev": true 1325 1701 }, 1702 "kareem": { 1703 "version": "2.4.1", 1704 "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz", 1705 "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA==" 1706 }, 1326 1707 "media-typer": { 1327 1708 "version": "0.3.0", … … 1329 1710 "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" 1330 1711 }, 1712 "memory-pager": { 1713 "version": "1.5.0", 1714 "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", 1715 "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", 1716 "optional": true 1717 }, 1331 1718 "merge-descriptors": { 1332 1719 "version": "1.0.1", … … 1364 1751 "requires": { 1365 1752 "brace-expansion": "^1.1.7" 1753 } 1754 }, 1755 "mongodb": { 1756 "version": "4.8.1", 1757 "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", 1758 "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", 1759 "requires": { 1760 "bson": "^4.6.5", 1761 "denque": "^2.0.1", 1762 "mongodb-connection-string-url": "^2.5.2", 1763 "saslprep": "^1.0.3", 1764 "socks": "^2.6.2" 1765 } 1766 }, 1767 "mongodb-connection-string-url": { 1768 "version": "2.5.3", 1769 "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", 1770 "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", 1771 "requires": { 1772 "@types/whatwg-url": "^8.2.1", 1773 "whatwg-url": "^11.0.0" 1774 } 1775 }, 1776 "mongoose": { 1777 "version": "6.5.3", 1778 "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.5.3.tgz", 1779 "integrity": "sha512-0L2ZOPzNQ7kcIgpdfpmVXc+/SypdhzcTlaHXYa983u1lrVp7/i3ekwHpPiTXxYBvV6FwBAsFoHI7+Ovf8tp3Mg==", 1780 "requires": { 1781 "bson": "^4.6.5", 1782 "kareem": "2.4.1", 1783 "mongodb": "4.8.1", 1784 "mpath": "0.9.0", 1785 "mquery": "4.0.3", 1786 "ms": "2.1.3", 1787 "sift": "16.0.0" 1788 }, 1789 "dependencies": { 1790 "ms": { 1791 "version": "2.1.3", 1792 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1793 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 1794 } 1795 } 1796 }, 1797 "mpath": { 1798 "version": "0.9.0", 1799 "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", 1800 "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==" 1801 }, 1802 "mquery": { 1803 "version": "4.0.3", 1804 "resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz", 1805 "integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==", 1806 "requires": { 1807 "debug": "4.x" 1808 }, 1809 "dependencies": { 1810 "debug": { 1811 "version": "4.3.4", 1812 "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 1813 "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 1814 "requires": { 1815 "ms": "2.1.2" 1816 } 1817 }, 1818 "ms": { 1819 "version": "2.1.2", 1820 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 1821 "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 1822 } 1366 1823 } 1367 1824 }, … … 1470 1927 "dev": true 1471 1928 }, 1929 "punycode": { 1930 "version": "2.1.1", 1931 "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 1932 "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 1933 }, 1472 1934 "qs": { 1473 1935 "version": "6.10.3", … … 1512 1974 "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 1513 1975 "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 1976 }, 1977 "saslprep": { 1978 "version": "1.0.3", 1979 "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", 1980 "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", 1981 "optional": true, 1982 "requires": { 1983 "sparse-bitfield": "^3.0.3" 1984 } 1514 1985 }, 1515 1986 "semver": { … … 1572 2043 } 1573 2044 }, 2045 "sift": { 2046 "version": "16.0.0", 2047 "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", 2048 "integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ==" 2049 }, 1574 2050 "simple-update-notifier": { 1575 2051 "version": "1.0.7", … … 1589 2065 } 1590 2066 }, 2067 "smart-buffer": { 2068 "version": "4.2.0", 2069 "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", 2070 "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" 2071 }, 2072 "socks": { 2073 "version": "2.7.0", 2074 "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", 2075 "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", 2076 "requires": { 2077 "ip": "^2.0.0", 2078 "smart-buffer": "^4.2.0" 2079 } 2080 }, 2081 "sparse-bitfield": { 2082 "version": "3.0.3", 2083 "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", 2084 "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", 2085 "optional": true, 2086 "requires": { 2087 "memory-pager": "^1.0.2" 2088 } 2089 }, 1591 2090 "statuses": { 1592 2091 "version": "2.0.1", … … 1624 2123 "requires": { 1625 2124 "nopt": "~1.0.10" 2125 } 2126 }, 2127 "tr46": { 2128 "version": "3.0.0", 2129 "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", 2130 "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", 2131 "requires": { 2132 "punycode": "^2.1.1" 1626 2133 } 1627 2134 }, … … 1655 2162 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 1656 2163 "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" 2164 }, 2165 "webidl-conversions": { 2166 "version": "7.0.0", 2167 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", 2168 "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" 2169 }, 2170 "whatwg-url": { 2171 "version": "11.0.0", 2172 "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", 2173 "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", 2174 "requires": { 2175 "tr46": "^3.0.0", 2176 "webidl-conversions": "^7.0.0" 2177 } 1657 2178 } 1658 2179 } -
backend/package.json
rb612ab1 r717ceae 12 12 "license": "ISC", 13 13 "dependencies": { 14 "express": "^4.18.1" 14 "bcryptjs": "^2.4.3", 15 "dotenv": "^16.0.1", 16 "express": "^4.18.1", 17 "mongoose": "^6.5.3" 15 18 }, 16 19 "devDependencies": { -
backend/server.js
rb612ab1 r717ceae 1 1 import express from "express"; 2 2 import data from "./data.js"; 3 import mongoose from "mongoose"; 4 import dotenv from "dotenv"; 5 import seedRouter from "./routes/seedRoutes.js"; 6 import productRouter from "./routes/productRoutes.js"; 7 8 dotenv.config(); 9 10 mongoose 11 .connect(process.env.MONGODB_URI) 12 .then(() => { 13 console.log("connected to db"); 14 }) 15 .catch((err) => { 16 console.log(err.message); 17 }); 3 18 4 19 const app = express(); 5 6 app.get("/api/products", (req, res) => { 7 res.send(data.products); 8 }); 9 10 app.get("/api/products/slug/:slug", (req, res) => { 11 const product = data.products.find((x) => x.slug === req.params.slug); 12 if (product) { 13 res.send(product); 14 } else { 15 res.status(404).send({ message: "Продуктот не е пронајден" }); 16 } 17 }); 18 19 app.get("/api/products/:id", (req, res) => { 20 const product = data.products.find((x) => x._id === req.params.id); 21 if (product) { 22 res.send(product); 23 } else { 24 res.status(404).send({ message: "Продуктот не е пронајден" }); 25 } 26 }); 20 app.use("/api/seed", seedRouter); 21 app.use("/api/products", productRouter); 27 22 28 23 const port = process.env.PORT || 5000;
Note:
See TracChangeset
for help on using the changeset viewer.