Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruslanzharkov/nodejs-shopping-cart
NodeJS / Express / MongoDB - Shopping Cart (monolithic app with handlebars)
https://github.com/ruslanzharkov/nodejs-shopping-cart
express expressjs handlebars javascript mongodb mongoose node nodejs shopping-cart
Last synced: 7 days ago
JSON representation
NodeJS / Express / MongoDB - Shopping Cart (monolithic app with handlebars)
- Host: GitHub
- URL: https://github.com/ruslanzharkov/nodejs-shopping-cart
- Owner: ruslanzharkov
- Created: 2017-10-22T17:21:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-12-07T04:05:02.000Z (about 2 months ago)
- Last Synced: 2025-01-07T10:08:32.774Z (14 days ago)
- Topics: express, expressjs, handlebars, javascript, mongodb, mongoose, node, nodejs, shopping-cart
- Language: JavaScript
- Homepage:
- Size: 961 KB
- Stars: 65
- Watchers: 4
- Forks: 29
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node js, Mongodb, Express js Shopping Cart
![image](https://user-images.githubusercontent.com/28437795/124288418-d3633a80-db59-11eb-8ecd-f01dba239fb7.png)
This project works with Stripe api on Nodejs and on the client representation as well.
Go to [Stripe](http://stripe.com/) for more information## Requirements
- [community mongodb installed locally](https://www.mongodb.com/docs/manual/administration/install-community/) or [cloud version](https://www.mongodb.com/atlas/database)
- node.js
- account on Stripe.js (for your test purchases)## Used middlewares
- connect-mongo
- express cookie
- nodemon
- morgan## Migrations
Current app implementation doesn't have a UI for adding new products,
but you can run script with migrations to add some products into DB and receive it from the application's UI.
Make sure MongoDB is installed and running first.```npm
npm run migration:write
```## ENV
Before running the app, you should create your own `.env` file in the root with the following variables:
```dotenv
PORT=
STRIPE_SECRET_KEY=
MONGO_DB_URL='mongodb://127.0.0.1:27017' or remote mongo address
```Note: make sure to add publc stripe key to `public/javascripts/checkout.js` in order to configure both server and client parts of Stripe.
```javascript
const stripePublishableTestKey = null;
// your public key should be here for proper Stripe work
// otherwise app generates en error with alert messageif (!stripePublishableTestKey) {
const error = 'Please add a Stripe.js public key';
alert(error);
throw new Error(error);
}Stripe.setPublishableKey(stripePublishableTestKey);
```### Running
- npm install
- add stripe test key to ENV file and to `checkout.js` (publishable not secret key for sender identification)
- npm start
- open browser at specified PORT env variables