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:

  1. Add the required modules:
    'use strict';
    
    const mongoose = require('mongoose');
    const Thread = mongoose.model('Thread');
  2. Export the module's methods:
    module.exports.allByUser = allThreadsByUser;
    module.exports.find = findThread;
    module.exports.open = openThread;
    module.exports.findById = findThreadById;
  3. Find all the threads for a specific ...

Get MEAN Blueprints 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.