Changeset 16237c4 for backend


Ignore:
Timestamp:
09/08/22 12:38:24 (2 years ago)
Author:
Nace Gjorgjievski <nace.gorgievski123@…>
Branches:
master
Children:
ee05663
Parents:
717ceae
Message:

Added Order Functionality

Location:
backend
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • backend/models/userModel.js

    r717ceae r16237c4  
    44  {
    55    name: { type: String, required: true },
     6    contact: { type: String, required: true },
    67    email: { type: String, required: true, unique: true },
    78    password: { type: String, required: true },
  • backend/package-lock.json

    r717ceae r16237c4  
    1313        "dotenv": "^16.0.1",
    1414        "express": "^4.18.1",
     15        "express-async-handler": "^1.2.0",
     16        "jsonwebtoken": "^8.5.1",
    1517        "mongoose": "^6.5.3"
    1618      },
     
    192194      }
    193195    },
     196    "node_modules/buffer-equal-constant-time": {
     197      "version": "1.0.1",
     198      "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
     199      "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
     200    },
    194201    "node_modules/bytes": {
    195202      "version": "3.1.2",
     
    316323      "engines": {
    317324        "node": ">=12"
     325      }
     326    },
     327    "node_modules/ecdsa-sig-formatter": {
     328      "version": "1.0.11",
     329      "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
     330      "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
     331      "dependencies": {
     332        "safe-buffer": "^5.0.1"
    318333      }
    319334    },
     
    385400      }
    386401    },
     402    "node_modules/express-async-handler": {
     403      "version": "1.2.0",
     404      "resolved": "https://registry.npmjs.org/express-async-handler/-/express-async-handler-1.2.0.tgz",
     405      "integrity": "sha512-rCSVtPXRmQSW8rmik/AIb2P0op6l7r1fMW538yyvTMltCO4xQEWMmobfrIxN2V1/mVrgxB8Az3reYF6yUZw37w=="
     406    },
    387407    "node_modules/fill-range": {
    388408      "version": "7.0.1",
     
    616636      }
    617637    },
     638    "node_modules/jsonwebtoken": {
     639      "version": "8.5.1",
     640      "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
     641      "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==",
     642      "dependencies": {
     643        "jws": "^3.2.2",
     644        "lodash.includes": "^4.3.0",
     645        "lodash.isboolean": "^3.0.3",
     646        "lodash.isinteger": "^4.0.4",
     647        "lodash.isnumber": "^3.0.3",
     648        "lodash.isplainobject": "^4.0.6",
     649        "lodash.isstring": "^4.0.1",
     650        "lodash.once": "^4.0.0",
     651        "ms": "^2.1.1",
     652        "semver": "^5.6.0"
     653      },
     654      "engines": {
     655        "node": ">=4",
     656        "npm": ">=1.4.28"
     657      }
     658    },
     659    "node_modules/jsonwebtoken/node_modules/ms": {
     660      "version": "2.1.3",
     661      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
     662      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
     663    },
     664    "node_modules/jwa": {
     665      "version": "1.4.1",
     666      "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
     667      "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
     668      "dependencies": {
     669        "buffer-equal-constant-time": "1.0.1",
     670        "ecdsa-sig-formatter": "1.0.11",
     671        "safe-buffer": "^5.0.1"
     672      }
     673    },
     674    "node_modules/jws": {
     675      "version": "3.2.2",
     676      "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
     677      "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
     678      "dependencies": {
     679        "jwa": "^1.4.1",
     680        "safe-buffer": "^5.0.1"
     681      }
     682    },
    618683    "node_modules/kareem": {
    619684      "version": "2.4.1",
    620685      "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz",
    621686      "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA=="
     687    },
     688    "node_modules/lodash.includes": {
     689      "version": "4.3.0",
     690      "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
     691      "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
     692    },
     693    "node_modules/lodash.isboolean": {
     694      "version": "3.0.3",
     695      "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
     696      "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
     697    },
     698    "node_modules/lodash.isinteger": {
     699      "version": "4.0.4",
     700      "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
     701      "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
     702    },
     703    "node_modules/lodash.isnumber": {
     704      "version": "3.0.3",
     705      "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
     706      "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
     707    },
     708    "node_modules/lodash.isplainobject": {
     709      "version": "4.0.6",
     710      "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
     711      "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
     712    },
     713    "node_modules/lodash.isstring": {
     714      "version": "4.0.1",
     715      "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
     716      "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
     717    },
     718    "node_modules/lodash.once": {
     719      "version": "4.1.1",
     720      "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
     721      "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
    622722    },
    623723    "node_modules/media-typer": {
     
    10211121      "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
    10221122      "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
    1023       "dev": true,
    10241123      "bin": {
    10251124        "semver": "bin/semver"
     
    13961495      }
    13971496    },
     1497    "buffer-equal-constant-time": {
     1498      "version": "1.0.1",
     1499      "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
     1500      "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
     1501    },
    13981502    "bytes": {
    13991503      "version": "3.1.2",
     
    14821586      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz",
    14831587      "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ=="
     1588    },
     1589    "ecdsa-sig-formatter": {
     1590      "version": "1.0.11",
     1591      "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
     1592      "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
     1593      "requires": {
     1594        "safe-buffer": "^5.0.1"
     1595      }
    14841596    },
    14851597    "ee-first": {
     
    15411653      }
    15421654    },
     1655    "express-async-handler": {
     1656      "version": "1.2.0",
     1657      "resolved": "https://registry.npmjs.org/express-async-handler/-/express-async-handler-1.2.0.tgz",
     1658      "integrity": "sha512-rCSVtPXRmQSW8rmik/AIb2P0op6l7r1fMW538yyvTMltCO4xQEWMmobfrIxN2V1/mVrgxB8Az3reYF6yUZw37w=="
     1659    },
    15431660    "fill-range": {
    15441661      "version": "7.0.1",
     
    17001817      "dev": true
    17011818    },
     1819    "jsonwebtoken": {
     1820      "version": "8.5.1",
     1821      "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
     1822      "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==",
     1823      "requires": {
     1824        "jws": "^3.2.2",
     1825        "lodash.includes": "^4.3.0",
     1826        "lodash.isboolean": "^3.0.3",
     1827        "lodash.isinteger": "^4.0.4",
     1828        "lodash.isnumber": "^3.0.3",
     1829        "lodash.isplainobject": "^4.0.6",
     1830        "lodash.isstring": "^4.0.1",
     1831        "lodash.once": "^4.0.0",
     1832        "ms": "^2.1.1",
     1833        "semver": "^5.6.0"
     1834      },
     1835      "dependencies": {
     1836        "ms": {
     1837          "version": "2.1.3",
     1838          "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
     1839          "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
     1840        }
     1841      }
     1842    },
     1843    "jwa": {
     1844      "version": "1.4.1",
     1845      "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
     1846      "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
     1847      "requires": {
     1848        "buffer-equal-constant-time": "1.0.1",
     1849        "ecdsa-sig-formatter": "1.0.11",
     1850        "safe-buffer": "^5.0.1"
     1851      }
     1852    },
     1853    "jws": {
     1854      "version": "3.2.2",
     1855      "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
     1856      "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
     1857      "requires": {
     1858        "jwa": "^1.4.1",
     1859        "safe-buffer": "^5.0.1"
     1860      }
     1861    },
    17021862    "kareem": {
    17031863      "version": "2.4.1",
    17041864      "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.4.1.tgz",
    17051865      "integrity": "sha512-aJ9opVoXroQUPfovYP5kaj2lM7Jn02Gw13bL0lg9v0V7SaUc0qavPs0Eue7d2DcC3NjqI6QAUElXNsuZSeM+EA=="
     1866    },
     1867    "lodash.includes": {
     1868      "version": "4.3.0",
     1869      "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
     1870      "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
     1871    },
     1872    "lodash.isboolean": {
     1873      "version": "3.0.3",
     1874      "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
     1875      "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
     1876    },
     1877    "lodash.isinteger": {
     1878      "version": "4.0.4",
     1879      "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
     1880      "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
     1881    },
     1882    "lodash.isnumber": {
     1883      "version": "3.0.3",
     1884      "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
     1885      "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
     1886    },
     1887    "lodash.isplainobject": {
     1888      "version": "4.0.6",
     1889      "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
     1890      "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
     1891    },
     1892    "lodash.isstring": {
     1893      "version": "4.0.1",
     1894      "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
     1895      "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
     1896    },
     1897    "lodash.once": {
     1898      "version": "4.1.1",
     1899      "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
     1900      "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
    17061901    },
    17071902    "media-typer": {
     
    19872182      "version": "5.7.1",
    19882183      "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
    1989       "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
    1990       "dev": true
     2184      "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
    19912185    },
    19922186    "send": {
  • backend/package.json

    r717ceae r16237c4  
    1515    "dotenv": "^16.0.1",
    1616    "express": "^4.18.1",
     17    "express-async-handler": "^1.2.0",
     18    "jsonwebtoken": "^8.5.1",
    1719    "mongoose": "^6.5.3"
    1820  },
  • backend/server.js

    r717ceae r16237c4  
    55import seedRouter from "./routes/seedRoutes.js";
    66import productRouter from "./routes/productRoutes.js";
     7import userRouter from "./routes/userRoutes.js";
     8import orderRouter from "./routes/orderRoutes.js";
    79
    810dotenv.config();
     
    1820
    1921const app = express();
     22
     23app.use(express.json());
     24app.use(express.urlencoded({ extended: true }));
     25
    2026app.use("/api/seed", seedRouter);
    2127app.use("/api/products", productRouter);
     28app.use("/api/users", userRouter);
     29app.use("/api/orders", orderRouter);
     30
     31app.use((err, req, res, next) => {
     32  res.status(500).send({ message: err.message });
     33});
    2234
    2335const port = process.env.PORT || 5000;
Note: See TracChangeset for help on using the changeset viewer.