Giter Site home page Giter Site logo

loopey-library-project's Introduction

Step 0: initial setup (ironlauncher)

Step 1: create Book Model + seeds file

Step 2: (READ) display a list with all books in the DB

  • Create a route (GET /books)
  • Make a request to the DB --> Book.find()
  • Create a view books-list.hbs (and pass the data from the database)

Step 3: (READ) book details page

  • Update books-list.hbs (add link to each book)
  • Create a route (GET /books/:bookId)
  • Make a request to the DB to get the details of book with id bookId --> Book.findById()
  • Create view (book-details.hbs)

Step 4: (CREATE) functionality to create new books

  • Step 4.a: display a form to create new books

    • Create a route (GET /books/create)
    • Create a view (book-create.hbs)
  • Step 4.b: process the form and save new book in DB

    • Create a route (POST /books/create)
    • Make a request to the DB to save the new book --> Book.create()
    • After book is created, we will redirect to /books (we don't need to create an additional view)

Step 5: (UPDATE) functionality to update a book

  • Step 5.a: display a pre-filled form to update a book

    • add link (eg. in book details page)
    • Create a route (GET /books/:bookId/edit)
    • Make a request to the DB --> Book.findById()
    • Create a view (book-edit.hbs) (and pass the data from the database)
  • Step 5.b: process form and update DB

    • Create a route (POST /books/:bookId/edit)
    • Query to the DB --> Book.findByIdAndUpdate(id, newBookDetails)
    • Redirect to the book details page

Step 6: (DELETE) functionality to delete a book

  • Add a button (ex. in the list of books) -it needs to be inside a form, so that we send a POST request.
  • Create a route (POST /books/:bookId/delete)
  • Query to DB --> Book.findByIdAndDelete(req.params.bookId)
  • Redirect to /books

loopey-library-project's People

Contributors

luisjunco 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.