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.
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:
'use strict'; const mongoose = require('mongoose'); const Thread = mongoose.model('Thread');
module.exports.allByUser = allThreadsByUser; module.exports.find = findThread; module.exports.open = openThread; module.exports.findById = findThreadById;