Code Monkey home page Code Monkey logo

burger's Introduction

Eat-Da-Burger! -- Node Express Handlebars

Overview

  • Eat-Da-Burger! is a restaurant app that lets users input the names of burgers they'd like to eat. Whenever a user submits a burger's name, your app will display the burger on the left side of the page -- waiting to be devoured.

  • Each burger in the waiting area also has a Devour it! button. When the user clicks it, the burger will move to the right side of the page.

  • Each devoured burger on the right side also has a Remove button to be deleted from the list and the internal database in the backend.

Deployment and Availability

Intallation

  • This full stack app can also be installed locally through the following steps
  1. Clone the git repository
    git clone https://github.com/mmakino/burger.git
    
  2. Install necessary packages
    npm install
    
    • This app uses the following NPM packages:
      "dotenv": "^6.2.0",
      "express": "^4.16.4",
      "express-handlebars": "^3.0.0",
      "mysql": "^2.16.0"
    
  3. Create a .env file under the top burger app directory for MySQL connection. Enter the user and password in the file. The format is simple as below:
    # Local MySQL user and password
    MYSQL_USER=<user_name>
    MYSQL_PASSWD=<password>
    
    # Heroku ClearDB Connection URL [OPTIONAL, NOT NEEDED For local server]
    CLEARDB_DATABASE_URL=mysql://[email protected]/heroku_12344567?reconnect=true
    
  4. MySQL database setup
    • db subdirectory contains two SQL query files.
      db
      ├── schema.sql
      └── seed.sql
    
    • The schema.sql needs to be run/sourced to set up the database and table for this app.
      • Database: burgers_db
      • Table: burgers
    • The seed.sql may be used to populate with small mock data(burgers!).
  5. Start the web server
    node server.js
    
    • It should display the following message when the server has started successfully
      Server started listening on port 3000
      Connected to database as ID: 771
      
  6. Open the web page in a browser by entering the following URL into the address bar.
    http://localhost:3000/
    

Demo

  • Although this is one page small app, hope the following snapshots give some ideas

  • Clicking on Devour It! button will move the burger to the right side. Demo Image home

  • Enter a burger name in the text box and press Add Your Burger to add the burger to be devoured. Demo Image home Demo Image home

  • All the burgers have been devoured. They can now be removed by clicking on the Remove buttons. Demo Image home

Directories & Files

burger
├── README.md                 -- this file
├── config
│   ├── connection.js         -- MySQL connection setup file
│   └── orm.js                -- Object Relational Mapper javascript
├── controllers
│   └── burgers_controller.js -- Implements routes for end-points
├── db
│   ├── schema.sql            -- MySQL database and table schema
│   └── seed.sql              -- Mock data (3 burgers)
├── homework_instructions.md  -- THe original instructions/requirements
├── models
│   └── burger.js             -- Interface btw the ORM and the controller
├── package.json              -- NPM JSON package file
├── public
│   └── assets
│       ├── css
│       │   └── style.css     -- Style sheet for the main page
│       ├── image
│       │   └── burger.png    -- Burger clip-art image
│       └── javascript
│           └── app.js        -- jQuery AJAX calling to routes
├── server.js                 -- The main server javascript file
└── views
    ├── images
    ├── index.handlebars      -- HTML body handlebars file
    └── layouts
        └── main.handlebars   -- Main HTML handlebars file

12 directories, 15 files

Written by Motohiko Makino

burger's People

Contributors

mmakino avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.