I am developing REST API using node.js and Express.
Houses collection and
Rooms collection. Every
Room belongs to exactly one
House for it's entire lifetime.
I'm not sure how to design API endpoints for managing
Rooms. My problem is that if I use endpoints like
/houses/:house__id/rooms for creating a room, getting all rooms or just one I still would need endpoints like
/rooms/:room_id for deleting a room. It it okay to divide creating, returning and deleting of
Rooms in such a way?
Or maybe I should structure my API in a way where
/rooms would handle creating, deleting, modifying and getting one room but still keep
/houses/:house_id/rooms so that all rooms for a house can be retrieved?
I'm fairly new when it comes to creating REST APIs and to be honest I didn't find any help in articles about best practices and such.