Skip to content

Add books you want to read and move them to the list of read books when completed

License

Notifications You must be signed in to change notification settings

akhalid88/read-a-book-ya-nerd

Repository files navigation

Read a Book Ya Nerd! License: MIT

This readme has been procedurally generated

Main


Table of Contents

  1. Description
  2. Deployed link
  3. Installation
  4. Usage
  5. Code snippets
  6. Licenses
  7. Contributing
  8. Tests
  9. Questions

Description

A simple book tracker. Add books you want to read and move them to the list of read books when completed.


Deployed link

https://read-a-book-ya-nerd.herokuapp.com/


Installation

To install locally, download repo and install dependencies using the following command:

npm install

Usage

To use this repo you will need a working knowledge of Javascript and Node.

To run this tool use the following command. This will generate a markdown file in the root folder with the name of 'READMETOO.md'

node server.js

Code snippets

This project highlights the use of the Model-View-Controller or MVC framework. The idea is to separate the code into 3 main sections as per the name of the framework. The server side handles the model and the controller parts of the framework.

As yuou can see in the picture, the controller handles the routing of the paths. It then calls the model via 'book.all' in the example below which in turn calls the orm parent class handing the all the relevant field data so taht the ORM can run the MySQL query and return the data.

All

The View part of the framework is handled by the client side javascript and html/css. As seen in the code snippet below, when clicking on the button associated with '.create-form', the client grabs the the book name and the status of the book from the webpage and passes it along in the ajax call to the controller.

$(".create-form").on("submit", function (event) {
	event.preventDefault();
	var newBook = {
		book_name: $("#bo").val().trim(),
		devoured: $("[name=devoured]:checked").val().trim()
	};
	$.ajax("/api/books", {
		type: "POST",
		data: newBook
	}).then(function () {
		console.log("created new book");
		location.reload();
	});
});

Licenses

This project uses a MIT License.


Contributing

If you would like to contribute, you will need to know Javascript, Node JS, mySQL, MVC framework.


Tests

To run tests run the following command:

NA

Questions

Created by Muhammad A Khalid

If you have any questions you can reach me at the following email: akhalid.code@gmail.com

Follow my other work at GitHub: https://github.com/akhalid88/

About

Add books you want to read and move them to the list of read books when completed

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published