{"id":18614877,"url":"https://github.com/andrewjbateman/nodejs-mongoosedb-shoppingcart","last_synced_at":"2026-04-07T09:32:23.452Z","repository":{"id":42357507,"uuid":"165629093","full_name":"AndrewJBateman/nodejs-mongoosedb-shoppingcart","owner":"AndrewJBateman","description":":clipboard: Udemy Node.js tutorial shopping cart using mongoose to manage products for azure cloud database","archived":false,"fork":false,"pushed_at":"2022-12-10T16:41:04.000Z","size":1161,"stargazers_count":0,"open_issues_count":15,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T01:34:27.501Z","etag":null,"topics":["compression","crud","database-schema","deployment","development","express","helmet","heroku-deployment","javascript","mongodb","mongoose","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewJBateman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-14T09:02:50.000Z","updated_at":"2022-01-11T21:51:44.000Z","dependencies_parsed_at":"2023-01-26T04:15:18.189Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/nodejs-mongoosedb-shoppingcart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AndrewJBateman/nodejs-mongoosedb-shoppingcart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-mongoosedb-shoppingcart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-mongoosedb-shoppingcart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-mongoosedb-shoppingcart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-mongoosedb-shoppingcart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/nodejs-mongoosedb-shoppingcart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-mongoosedb-shoppingcart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31508053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compression","crud","database-schema","deployment","development","express","helmet","heroku-deployment","javascript","mongodb","mongoose","nodejs"],"created_at":"2024-11-07T03:27:16.831Z","updated_at":"2026-04-07T09:32:23.435Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js, mongoDB \u0026 Mongoose Shopping Cart\n\n* Code to learn to learn Node.js. This is part of a [Udemy NodeJS - The Complete Guide (incl. MVC, REST APIs, GraphQL)](https://www.udemy.com/nodejs-the-complete-guide/).\n\n**Note: to open web links in a new window use: _ctrl+click on link_**\n\n## Table of contents\n\n* [General info](#general-info)\n* [Screenshots](#screenshots)\n* [Technologies](#technologies)\n* [Setup](#setup)\n* [Features](#features)\n* [Status](#status)\n* [Inspiration](#inspiration)\n* [Contact](#contact)\n\n## General info\n\n* Working shopping cart where products can be created, read, updated and deleted (CRUD) via a local web browser and are stored in a cloud-based mongoDB database. Products can be added to a cart and 'ordered' under an auto-generated order number. The login now created a session cookie that expires after a time set in app.js.\n\n## Screenshots\n\n![screenprint](./images/home.png)\n![screenprint](./images/signup.png)\n\n## Technologies\n\n* [Node.js v10.15.0 LTS](https://nodejs.org)\n\n* [Express v4.16.4](https://www.npmjs.com/package/express)\n\n* [Express-session v1.15.6](https://www.npmjs.com/package/express-session)\n\n* [MongoDB Atlas v4.0](https://www.mongodb.com/cloud/atlas)\n\n* [MongoDB Compass v1.16.3](https://www.mongodb.com/download-center/compass) on an Azure cloud server.\n\n* [Mongoose v5.2.17](https://mongoosejs.com)\n\n* [Nodemailer](https://nodemailer.com/about/) module is used with the [SendGrid API](https://sendgrid.com/docs/) to send new users an email when they first sign up.\n\n* [Multer](https://github.com/expressjs/multer), node.js middleware for handling multipart/form-data; mainly for uploading files.\n\n* [PDFKit](https://pdfkit.org/), a JavaScript PDF generation library for Node and the browser. This is used to create an order invoice pdf.\n\n* [stripe](https://stripe.com), an online payment API, is added.\n\n* [Helmet](https://helmetjs.github.io/) added to allow setting of HTTP headers to increase app security. Needs to be configured.\n\n* [Compression](https://www.npmjs.com/package/compression) middleware added to compress response bodies for all requests that traverse through the middleware, unless they include a Cache-Control header with the no-transform directive, as compressing will transform the body.\n\n## Setup\n\n* type `nodemon app.js` then navigate to `localhost:3000`\n\n## Code Examples\n\n* `/routes/admin.js` router.post route to add a product entered by the user, if authorized.\n\n```javascript\nrouter.post(\n  '/add-product',\n  [\n    body('title')\n      .isString()\n      .isLength({ min: 3 })\n      .trim(),\n    body('price').isFloat(),\n    body('description')\n      .isLength({ min: 5, max: 400 })\n      .trim()\n  ],\n  isAuth,\n  adminController.postAddProduct\n);\n\n```\n\n## Features\n\n* Once logged in it is possible to add products to a shop website.\n\n* User authorization is done by issuing a time-limited session cookie.\n\n## App Status\n\n* App compiles and navigates to Shop, Products, Signup and Login pages. Signup and login pages work.\n\n* When I add a product I get an error and the app crashes: `TypeError: Cannot read property 'isLoggedIn' of undefined` I think this is an authentication error.\n\n## To-do list\n\n1. Go through course and code and comment better. Fix issue with authentication.\n\n## Inspiration\n\n* [NodeJS - The Complete Guide (incl. MVC, REST APIs, GraphQL)](https://www.udemy.com/nodejs-the-complete-guide/)\n\n* [Medium article by Nick Karnik: Introduction to Mongoose for MongoDB](https://medium.freecodecamp.org/introduction-to-mongoose-for-mongodb-d2a7aa593c57)\n\n## Contact\n\nRepo created by [ABateman](https://www.andrewbateman.org) - feel free to contact me!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnodejs-mongoosedb-shoppingcart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fnodejs-mongoosedb-shoppingcart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnodejs-mongoosedb-shoppingcart/lists"}