here i had to make backend for chat
- Проверить, что инстанс MongoDB запущен
- Установить зависимости npm install
- Запустить сервер npm start
- Производить запросы через Postman
Поскольку база пустая - будет возвращен пустой массив, можете заполнить своими данными.
http://localhost:1428/api/user/
http://localhost:1428/api/user/
http://localhost:1428/api/user/:id
http://localhost:1428/api/user/5b48d35ce37590c5badd1e3f
http://localhost:1428/api/user/
{ "name": "Elvis", "email": "elvis@gmail.com" }
http://localhost:1428/api/user/:id
http://localhost:1428/api/user/5b48d35ce37590c5badd1e3f
{ "name": "Super Elvis", "email": "superelvis@gmail.com" }
http://localhost:1428/api/user/:id
http://localhost:1428/api/user/5b48d35ce37590c5badd1e3f;
http://localhost:1428/api/message/
http://localhost:1428/api/message/
http://localhost:1428/api/message/:id
http://localhost:1428/api/message/5b4a001748a4c03dd86a796f
http://localhost:1428/api/message/
{ "senderId": "5b4a77635c1795c5142b1f77", "bodyMes": "Hi, how r u?", "receiverId": "5b4a432f377c1b857c1dec5f" }
http://localhost:1428/api/message/:id
http://localhost:1428/api/message/5b4a77635c1795c5142b1f77
{ "senderId": "5b4a77635c1795c5142b1f77", "bodyMes": "Hi, how r u? what did happen yesterday?", "receiverId": "5b4a432f377c1b857c1dec5f" }
http://localhost:1428/api/message/:id
http://localhost:1428/api/message/5b4a77635c1795c5142b1f77
Выводит пользователей, недублированных с которыми общался пользователь с данным id, имеет лимит в 5 единиц
localhost:1428/api/message/getUsers/5b4a77635c1795c5142b1f77