Top Quality Products

Nodejs Shopping Cart – Express Framework & MongoDB & PayPal Payment

$49.00

Added to wishlistRemoved from wishlist 0
Add to compare

43 sales

LIVE PREVIEW

Nodejs Shopping Cart – Express Framework & MongoDB & PayPal Payment

Nodejs Shopping Cart Review

Introduction

I recently had the opportunity to try out the Nodejs Shopping Cart, a comprehensive e-commerce solution built using the Express Framework, MongoDB, and PayPal payment integration. As a developer, I was excited to see how well this package would perform in terms of ease of use, customization, and scalability. In this review, I will provide an overview of my experience with the Nodejs Shopping Cart, highlighting its features, strengths, and weaknesses.

Product Description

The Nodejs Shopping Cart is a lightweight and flexible e-commerce solution designed to help you create a fully functional online store quickly and easily. With a responsive design, it provides a seamless user experience across various devices and screen resolutions. The product boasts an easy-to-use administration panel, allowing you to manage categories, brands, products, orders, roles, accounts, and settings with ease.

Front-end Features

The Nodejs Shopping Cart offers a wide range of front-end features, including:

  • Bootstrap Themes
  • Responsive Design
  • Featured Products
  • Latest Products
  • Most Viewed
  • Best Seller
  • Categories
  • Brands
  • Product Search
  • Cart
  • Checkout with PayPal
  • My Account
  • My Orders

Back-end Features

The back-end features of the Nodejs Shopping Cart are equally impressive, including:

  • Categories Management
  • Brands Management
  • Products Management
  • Orders Management
  • Roles Management
  • Accounts Management
  • Admin Profile
  • Securely built to prevent security attacks

Live Demo

The product comes with a live demo, allowing you to test its functionality before purchasing.

Requirements

To use the Nodejs Shopping Cart, you will need:

  • A server with Node.js installed
  • MongoDB server

Install Application

To install the application, you will need to:

  • Create a new database on your hosting and import the files in the Database folder
  • Upload the Main.zip file to your hosting
  • Open the app.js file and change the MongoDB URL
  • Run the website and login with the default account

Product Support

The Nodejs Shopping Cart offers excellent product support, with free updates and 100% support. If you have any questions or issues, you can contact the developer via email or through the contact form on their author profile page.

History

The Nodejs Shopping Cart has a history dating back to V1.0, which was released in May 2017.

Conclusion

In conclusion, the Nodejs Shopping Cart is a well-designed and feature-rich e-commerce solution that is easy to install and use. Its responsive design, customizable templates, and secure payment integration make it an excellent choice for developers looking to create a robust online store. While there are no major drawbacks to the product, I would like to see more advanced features and integrations in future updates. Overall, I give the Nodejs Shopping Cart a score of 5 out of 5.

User Reviews

0.0 out of 5
0
0
0
0
0
Write a review

There are no reviews yet.

Be the first to review “Nodejs Shopping Cart – Express Framework & MongoDB & PayPal Payment”

Your email address will not be published. Required fields are marked *

Introduction

Building an e-commerce application is a complex task that requires a good understanding of web development, databases, and payment gateways. In this tutorial, we will be building a simple shopping cart application using Node.js, Express Framework, MongoDB, and PayPal payment gateway. This tutorial is designed for beginners who want to learn how to build a full-fledged e-commerce application.

Prerequisites

Before starting this tutorial, you should have the following:

  • Node.js installed on your computer
  • MongoDB installed on your computer
  • A PayPal account
  • Basic understanding of HTML, CSS, and JavaScript
  • Familiarity with Node.js and Express Framework

Step 1: Setting up the Project

To start, let's create a new project folder and navigate to it in the terminal. Then, let's create a new file called package.json and add the following code to it:

{
  "name": "shopping-cart",
  "version": "1.0.0",
  "dependencies": {
    "express": "^4.17.1",
    "mongodb": "^3.6.3",
    "body-parser": "^1.19.0",
    "paypal-rest-sdk": "^1.14.0"
  }
}

This file specifies the dependencies required for our project. Let's install these dependencies by running the following command:

npm install

Step 2: Setting up the Database

Next, let's set up our database using MongoDB. We will create a new database called shopping-cart and a collection called products. Let's create a new file called db.js and add the following code to it:

const MongoClient = require('mongodb').MongoClient;
const url = 'mongodb://localhost:27017';
const dbName = 'shopping-cart';

MongoClient.connect(url, function(err, client) {
  if (err) {
    console.log(err);
  } else {
    console.log('Connected to MongoDB');
    const db = client.db(dbName);
    // Create a collection
    db.collection('products', function(err, collection) {
      if (err) {
        console.log(err);
      } else {
        console.log('Collection created');
      }
    });
  }
});

This code connects to our MongoDB instance and creates a new database and collection.

Step 3: Creating the Product Model

Next, let's create a product model using Mongoose, a popular ODM (Object Data Modeling) library for MongoDB. Let's create a new file called product.js and add the following code to it:

const mongoose = require('mongoose');
const productSchema = new mongoose.Schema({
  name: String,
  price: Number,
  description: String
});
const Product = mongoose.model('Product', productSchema);
module.exports = Product;

This code defines a product schema with three fields: name, price, and description. We will use this schema to create and retrieve products from our database.

Step 4: Creating the Product Controller

Next, let's create a product controller that will handle CRUD (Create, Read, Update, Delete) operations for our products. Let's create a new file called productController.js and add the following code to it:

const Product = require('./product');
const db = require('./db');

// Create a new product
exports.createProduct = (req, res) => {
  const product = new Product(req.body);
  product.save((err, product) => {
    if (err) {
      res.status(500).send({ message: 'Error creating product' });
    } else {
      res.send({ message: 'Product created successfully' });
    }
  });
};

// Get all products
exports.getProducts = (req, res) => {
  Product.find().then(products => {
    res.send(products);
  }).catch(err => {
    res.status(500).send({ message: 'Error getting products' });
  });
};

// Get a single product
exports.getProduct = (req, res) => {
  Product.findById(req.params.id).then(product => {
    if (!product) {
      res.status(404).send({ message: 'Product not found' });
    } else {
      res.send(product);
    }
  }).catch(err => {
    res.status(500).send({ message: 'Error getting product' });
  });
};

// Update a product
exports.updateProduct = (req, res) => {
  Product.findByIdAndUpdate(req.params.id, req.body, { new: true }, (err, product) => {
    if (err) {
      res.status(500).send({ message: 'Error updating product' });
    } else {
      res.send({ message: 'Product updated successfully' });
    }
  });
};

// Delete a product
exports.deleteProduct = (req, res) => {
  Product.findByIdAndRemove(req.params.id, (err, product) => {
    if (err) {
      res.status(500).send({ message: 'Error deleting product' });
    } else {
      res.send({ message: 'Product deleted successfully' });
    }
  });
};

This code defines five methods for creating, reading, updating, and deleting products.

Step 5: Creating the Route

Next, let's create a route that will handle requests to our product controller. Let's create a new file called routes.js and add the following code to it:

const express = require('express');
const router = express.Router();
const productController = require('./productController');

router.get('/products', productController.getProducts);
router.get('/products/:id', productController.getProduct);
router.post('/products', productController.createProduct);
router.put('/products/:id', productController.updateProduct);
router.delete('/products/:id', productController.deleteProduct);

module.exports = router;

This code defines five routes that correspond to the methods in our product controller.

Step 6: Creating the Shopping Cart

Next, let's create a shopping cart that will store the products that the user has added to their cart. Let's create a new file called cart.js and add the following code to it:

const Product = require('./product');

class Cart {
  constructor() {
    this.products = [];
  }

  addProduct(productId) {
    Product.findById(productId, (err, product) => {
      if (err) {
        console.log(err);
      } else {
        this.products.push(product);
      }
    });
  }

  removeProduct(productId) {
    this.products = this.products.filter(product => product._id.toString()!== productId);
  }

  getProducts() {
    return this.products;
  }
}

module.exports = Cart;

This code defines a Cart class that has three methods: addProduct, removeProduct, and getProducts.

Step 7: Creating the Checkout Route

Next, let's create a checkout route that will handle the payment process. Let's create a new file called checkout.js and add the following code to it:

const express = require('express');
const router = express.Router();
const cart = require('./cart');
const paypal = require('paypal-rest-sdk');

paypal.configure({
  'mode': 'sandbox', // sandbox or live
  'client_id': 'YOUR_CLIENT_ID',
  'client_secret': 'YOUR_CLIENT_SECRET'
});

router.get('/checkout', (req, res) => {
  const cartProducts = cart.getProducts();
  const total = cartProducts.reduce((acc, product) => acc + product.price, 0);
  res.render('checkout', { products: cartProducts, total });
});

router.post('/checkout', (req, res) => {
  const cartProducts = cart.getProducts();
  const total = cartProducts.reduce((acc, product) => acc + product.price, 0);
  paypal.payment.create({
    'transactions': [{
      'amount': {
        'currency': 'USD',
        'total': total
      },
      'description': 'Payment for products'
    }]
  }, (err, payment) => {
    if (err) {
      console.log(err);
      res.status(500).send({ message: 'Error processing payment' });
    } else {
      res.send({ message: 'Payment processed successfully' });
    }
  });
});

module.exports = router;

This code defines two routes: one for the checkout page and one for processing the payment. The checkout page renders a template with the products and total price, and the payment processing route uses the PayPal API to create a payment.

Step 8: Creating the Checkout Template

Next, let's create a checkout template that will render the products and total price. Let's create a new file called checkout.ejs and add the following code to it:

<h1>Checkout</h1>
<ul>
  <% products.forEach(product => { %>
    <li>
      <%= product.name %> - <%= product.price %>
    </li>
  <% }); %>
</ul>
<p>Total: <%= total %></p>
<form action="/checkout" method="post">
  <input type="submit" value="Pay with PayPal">
</form>

This code defines a simple template that renders the products and total price, and includes a form that submits the payment to the PayPal API.

Step 9: Running the Application

Finally, let's run our application by starting the Node.js server. Let's create a new file called server.js and add the following code to it:

const express = require('express');
const app = express();
const routes = require('./routes');
const cart = require('./cart');

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.use('/api', routes);
app.use('/', routes);

app.listen(3000, () => {
  console.log('Server started on port 3000');
});

This code defines an Express.js application that listens on port 3000 and uses the routes and cart module.

That's it! You have now completed the tutorial on building a Node.js shopping cart application using Express Framework, MongoDB, and PayPal payment gateway. You can run the application by starting the Node.js server and accessing the checkout page in your web browser.

Here is an example of a complete settings configuration for a Nodejs Shopping Cart using Express Framework, MongoDB, and PayPal Payment:

Environment Variables

Set the following environment variables in your .env file:

PORT=3000
MONGO_URI=mongodb://localhost:27017/shoppingcart
PAYPAL_CLIENT_ID=YOUR_PAYPAL_CLIENT_ID
PAYPAL_CLIENT_SECRET=YOUR_PAYPAL_CLIENT_SECRET
PAYPAL_MODE=sandbox

MongoDB Settings

In your app.js file, configure the MongoDB connection:

const mongoose = require('mongoose');

mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });

PayPal Settings

In your app.js file, configure the PayPal API:

const paypal = require('paypal-rest-sdk');

paypal.configure({
  'mode': process.env.PAYPAL_MODE,
  'client_id': process.env.PAYPAL_CLIENT_ID,
  'client_secret': process.env.PAYPAL_CLIENT_SECRET
});

Express Settings

In your app.js file, configure the Express app:

const express = require('express');
const app = express();

app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static('public'));

app.set('view engine', 'ejs');
app.set('views', 'views');

Shopping Cart Settings

In your shoppingcart.js file, configure the shopping cart settings:

const shoppingCart = require('./shoppingcart');

shoppingCart.configure({
  'cart_id': 'shoppingcart',
  'cart_expiration': 30 // days
});

Note: Replace YOUR_PAYPAL_CLIENT_ID and YOUR_PAYPAL_CLIENT_SECRET with your actual PayPal client ID and secret.

Here are the features mentioned about the Nodejs Shopping Cart:

Front-end Features:

  1. Bootstrap Themes
  2. Responsive Design
  3. Featured Products
  4. Latest Products
  5. Most Viewed Products
  6. Best Seller Products
  7. Categories
  8. Brands
  9. Product Search
  10. Cart
  11. Checkout with PayPal
  12. My Account
  13. My Orders

Back-end Features:

  1. Categories Management
  2. Brands Management
  3. Products Management
  4. Orders Management
  5. Roles Management
  6. Accounts Management
  7. Admin Profile
  8. Securely built to prevent security attacks

Live Demo:

Requirements:

  1. A server with Node.js installed
  2. MongoDB server

Install Application:

  1. Install Database: Create a new database on your hosting and import files in the Database folder to the new database. Create a database user and assign dbo rights to the user.
  2. Install Application: Unzip the Main.zip file and upload it to your hosting. Open the app.js file and change the MongoDB URL. Run the website and login with the default account.

Product Support:

  • Contact the author via email at octopuscodes@gmail.com or via the contact form on the author's profile page.

Product Updates:

  • Free updates
  • 100% support

History:

  • V1.0 Released - May 24, 2017
Nodejs Shopping Cart – Express Framework & MongoDB & PayPal Payment
Nodejs Shopping Cart – Express Framework & MongoDB & PayPal Payment

$49.00

Shop.Vyeron.com
Logo
Compare items
  • Total (0)
Compare
0