A Node, Express, Handlebars, and MySQL burger app that lets users input the names of burgers they'd like to eat... and then devour them!
This app is a remake of the original Burger repo found here. The key difference is that is uses the Sequelize ORM rather than raw MySQL queries. And, using Sequelize, the app is now relational, tracking which users ate which burger.
Please try out the deployed app in Heroku, found here.
Using the Sequelize ORM, the app has 3 basic CRUD functions...
- READ all entries from the MySQL database and display them to the DOM using Handlebars. * note that at a SQL join is used to match each devoured burger to its respective customer.
- UPDATE a selected burger by clicking "Devour It", which...
* hits an
/burger/eat/:idroute in Express to change its "devoured" status in the MySQL database (via Sequelize ORM) * re-routes the webpage back to the index, where the burger is now in the devoured column (via Handlebars) - CREATE a new burger using the "Place Order" form, which...
* hits a
/burger/createroute in Express to insert a new burger into the MySQL database (via Sequelize ORM) * re-routes the webpage back to the index, where the burger is now ready to be eaten column (via Handlebars)
If you wish to clone the app down to your local machine...
- Use MySQL Workbench to create a database called
burgers_db:
- The raw SQL query is
CREATE DATABASE burgers_db;.
- Inside the
configfolder, open up theconfig.jsonfile:
- In the
developmentobject, add your MySQL localhostpassword.
- In your terminal,
cdinto the project folder and run:
npm installto download all node.js dependenciessequelize db:migrate && sequelize db:seed:allto migrate/seed the database via Sequelize CLI
- Finally, you can run the programming using:
node server.jsin the terminal to start the node server- And navigating to
localhost:3000in your browser.
The app also has a funny "Whine" feature, where random sound effects are played to grieve a devoured burger. This feature uses jQuery click listeners.
If a customer does not enter their name upon devouring a burger, it will default to Anynomous.
Lastly, the app's front-end design uses Bootstrap. This means that your burgers look just as tasty on mobile as they do on desktop. Please see the screenshots below...
The Sequelize models were generated using the Sequelize CLI (Command Line Interface).
For more information regarding those nifty commands, please refer to the schema.sql file inside the db folder.
Lastly, heroku deployment setup was similiar to localhost setup. After adding JASWDB to the app, the following was done...
- Connected to the JAWSDB database using MySQL workbench and the hostname and passwords provided for my app
- From node, two commands were used to migrate and seed the db...
heroku run sequelize db:migrate --env production -m --app eat-da-burgerz-2heroku run sequelize db:seed:all --env production -m --app eat-da-burgerz-2

