API beginnings

DB connection, return JSON encoded results, some "page" logic.