Git Product home page Git Product logo

cruddy-board-games-project's Introduction

Cruddy Board Games

This app stores a list of a board game names and their descriptions in an array of objects in a local JSON file. The website supports basic CRUD operations (create, read, update and delete) through a RESTful interface using HTTP methods (GET, POST, PUT, DELETE).

HTML forms DO NOT support HTTP methods PUT and DELETE, so jQuery is used to intercept user interactions when someone tries to submit an edit form or clicks on a delete link. jQuery uses .preventDefault() to halt the normal action and creates an AJAX request instead.

screenshot

Installation

  1. Download the repo.
  2. use 'npm install' to install dependencies
  3. run nodemon to start the server
  4. visit the page running at http://localhost:3000

Task

Implement the routing for all the routes in the next section.

Suggested order of operations:

  1. Do the GET routes first. Then, POST, PUT, DELETE.
  2. For each route:
    1. Write the routing logic in app.js
    2. Create the template inside the folder views/games/
    3. Pass data from the route handler in app.js to the template (res.render)
    4. If required, listen for events in JS (static/js/main.js) and use AJAX

Full RESTful Routing

Verb Path Action Used for
GET /games index display a list of all games
GET /games/new new return an HTML form for creating a new game
POST /games create create a new game (using form data from /games/new)
GET /games/:name show display a specific game
GET /games/:name/edit edit return an HTML form for editing a game
PUT /games/:name update update a specific game (using form data from /games/:name/edit)
DELETE /games/:name destroy deletes a specific game

BONUS

  • Use gamesWithNull.json instead of games.json. How will you make sure you're using an object instead of a null value?
  • Replace synchronous I/O functions with asynchronous. (fs.readFile instead of fs.readFileSync)
  • Use a database instead of games.json

Licensing

All content is licensed under a CC­BY­NC­SA 4.0 license. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

cruddy-board-games-project's People

Contributors

connorjclark avatar foozie3moons avatar shullmb avatar sixhops 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.