Coder Social home page Coder Social logo

saranp-33 / bookapp2 Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 2.24 MB

A simple full stack app. When the user adds a book, this book is saved in MySQL database. This app uses Express to communicate the user input to the database and Handlebars as the UI.

JavaScript 49.41% CSS 16.14% Handlebars 34.45%
handlebars sequelize mysql expressjs nodejs

bookapp2's Introduction

bookapp2

bookapp

An app using node, Express, Handelbars and MySQL to show how we can do a simple full stack application.

This app allows to demonstrate how the user input can be answered by the server (Express)and have data stored in a database (MySQL). the rendering of this app was done using Handlebars.

In this project the package used to perfrom the queries and sync the database with the server was Sequelize.

This app was deployed to Heroku. in order to sync the database in a manner that heroku could access it, Jaws_DB was added to the app and new local instance in the MySQL workbench was created.

Sample Images

Add a New Book

Below is an example of hose the user inputs the book title they want to add. When they click add, that request goes through the server who then does the work to

  1. tell the data base to store this new book
  2. Send the response back so the front-end can post the result.

add

Click to Devour the Book

If the user decides that one of the books on the list is the one he wants to "devour" he can click on the button devour and the book will be sent to the column on the right.

Server side, when we click on that button we are updating the book status of devoured from false to true. When the user clicks this button it sends the information to the front end that the status of this book has cahnged in the datavase and therefore belongs in the other table.

Devour

Read that Book Again!

If you are anything like me, reading a book once is not enough. The user has the option to read the book again. This action mirrors the devour one.

Read-again

Delete Book

The user can also decide that they want to delete a book completly from their lists. When the user clicks that burron a request is sent to the server to delete the book from the database. There is a set of instructions sent to the database then to execute the deletion which in turn is seen by the user through the book being deleted on the page.

delete

Instalation

For this project th instalation of three diferent npm packages to complete the app was required.

MySql2 npm package allows to connect to the Mysql database and work with through the command line by interfacing MySQL with Sequelize.

npm install mysql2

The server set up in this app is express. In order work with it through in the command line, it is necessary to install it.

npm install express

As mentioned above, handlebars is the template uded to render this app. in order to be able to work with Handlebars, it is necessary to install it through npm as well.

npm install express-handlebars

In this application, instead of ORM, Sequelize was the npm package used to perform all the queries to the database.

npm instal sequelize

Previously i also installed in my local machine a global version of a CLI sequelized

npm install -g sequelize-cli sequelize

This allows me to run sequelize through my command line after I declared it as dependecy in my porjects package JSON. Through this I can then initiate a Config and models folder with the necessary information to successfully use sequelize to connect the database to the server and do the neccessary queries.

sequelize init:config
sequelize init:models

Built With

Deployed Link

Author

  • Sara Neves Pereira

License

This project is licensed under the MIT License

bookapp2's People

Contributors

saranp-33 avatar dependabot[bot] avatar

Stargazers

Ribamar FS avatar

Watchers

James Cloos 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.