/MYSQL-ORM-Node-Express-Handlebars-Hamburger-APP

In this repo I demonstrate the use of an ORM for my database to perform CRUD operations and display data through Handlebar views.

Primary LanguageJavaScript

MYSQL-ORM-Node-Express-Handlebars-Hamburger-APP

Example of using MYSQL with an ORM on an Expressjs server using Nodejs with the MVC model. This application performes all CRUD operations to a MYSQL database.

Project Overview

This app allows you to add, edit update and delete hamburgers of your choice with out gaining any of the calories. YUM!

View Demo

To view demo click on this link: (Heroku Demo Link)

Getting Started Locally

To get the Node server running locally:

  • Clone this repo (GIT)
  • Install Nodejs on your Mac (Download)
  • npm install to install all required dependencies
  • load the .sql file locally and make sure the credentials match up.
  • node server.js to start the node application.

Code Overview

Dependencies

  • body-parser - Parse incoming request bodies in a middleware before your handlers, available under the req.body property.
  • express - Fast, unopinionated, minimalist web framework (for servers) for node.
  • path - This is an exact copy of the NodeJS ’path’ module published to the NPM registry.
  • dotenv - Loads environment variables from .env file
  • handlebars - andlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • mysql - A node.js driver for mysql. It is written in JavaScript

Dev Dependencies

  • nodmon - nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application.

Application MVC Structure

  • server.js - The entry point to our application for the customer user type.
  • routes.js - Entry point for the applications routes.
  • /views - Applications template files using handlebars.
  • /routes - The routes of this application.
  • /public - All public facing assets are in this directory.
  • /models - The application models for use with ORM.
  • /db - Starter database files.
  • /controllers - Most of the application's logic for requests and responses are done in this directory.
  • /config - Database configuration.