How to expose database as api