Updated posts api to support /api/posts/ endpoint