Added error handling and DB

Added error handling to check for null in outside conditions.
Moved copy of the database script to the new Node.js project.