Skip to content

Latest commit

 

History

History
75 lines (46 loc) · 2.33 KB

README.md

File metadata and controls

75 lines (46 loc) · 2.33 KB

##mlb-db mlb-db is a web app for accessing Major League Baseball (MLB) team and player profiles and statistics.
Uses Sean Lahman Baseball Database. The latest version of this database has stats from 1871 - 2013.

##Design Architecture

###Front End

  1. UI - Bootstrap 3

  2. Namespacing - Single global: spa

  3. Modules

  • spa.shell.js - controller/router , initializes all modules
  • spa.player.js - model and view for player list, player profiles and player stats
  • spa.team.js - model and view for team list, team profiles and team stats
  • spa.autoc_search.js - model and view for auto-complete search (for desktop)
  • spa.search.js - model and view for search feature (for phones & tablets)
  • spa.pagination.js - pagination for player and team list views

Templates

  • Handlebars.js is used for templating. Templates are in separate files
    loaded at startup, compiled and stored and cached.

####MVC architecture
This design doesn't implement separate model/view functionality but does feature
a controller/router module.(spa.shell.js)

  • Initializes all modules Handles URI hashchange events triggered by model/view modules to
    trigger DB requests

  • All views (player list, team list etc.) are bookmarkable.

####Other Features:

  • auto-complete search
  • pagination support using jquery.jqpagination jQuery plugin

###Back End

Node 0.10.x/Express 3.2.x MongoDB 2.6.x/mongodb Native driver 1.3.x

  • mongoimport used to import csv database files to collections
  • Uses mongodb aggregation framework for some queries (ex. player career stats)

Performance Tuning

  1. Indexes are created on several mongoDB collections (db-config.js)
  2. Use res.setHeader('Cache-Control', 'public, max-age=xxxx');
    to cache static files and database responses.

###Cloud Hosting

Heroku & mongolab