Thread backend
In the Node.js backend application, we are going make available endpoints, defined in our Express application routes, related to managing conversation threads. Also, there should be a way to get the message history from a specific thread.
Thread controller
We are going to add the necessary business logic to manage our threads in a new controller file, called app/controllers/thread.js
, by following these steps:
- Add the required modules:
'use strict'; const mongoose = require('mongoose'); const Thread = mongoose.model('Thread');
- Export the module's methods:
module.exports.allByUser = allThreadsByUser; module.exports.find = findThread; module.exports.open = openThread; module.exports.findById = findThreadById;
- Find all the threads for a specific ...
Get Web Application Development with MEAN now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.