Chat backend via node.js: How to create 2 entities - users and messages?
2017-07-17 06:18:59 UTC
I have this task I can't understand how to handle it step-by-step. You may know the situation I have now: you listened to a theory lecture, but when it comes to practise, you don't know how to handle it until a tutor shows you the process of it. I didn't get an example of how to perform it, so I have to ask here.
The task details are:
Each entity implements the CRUD (create, read, update, delete) through REST (post, get, put, delete).
The user entity contains the basic fields (name, etc.)
Messages entity contains senderId and receiverId (id users), as well as the body of the message.
Create a router that returns all users that the user with this id has talked to.
The data can be stored in memory (as in the
) or in MongoDB.
Split the responsibility of backend modules similar to
given- routes, services, an optional repositories.
Describe all the routes in the README.md repository.