Update index.js

fixing to test for issue where db.models is undefined