Commit e4a64d43 authored by Balasuriya D.A.M.'s avatar Balasuriya D.A.M.

Defining Chat API Routes

parent 61a8047c
const express = require("express");
const { protect } = require("../middleware/authMiddleware");
//create router object
const router = express.Router();
//only login user can access this route.
//router.route("/").post(protect, accessChat);
//router.route("/").get(protect, fetchChats);
//router.route("/group").post(protect, createGroupChat); //create group
//router.route("/rename").put(protect, renameGroup); //update group
//router.route("/groupremove").put(protect, removeFromGroup); //remove from group
//router.route("/groupadd").put(protect, addToGroup); //add someone to group
module.exports = router;
......@@ -5,6 +5,7 @@ const { chats } = require("./data/data");
const connectDB = require("./config/db");
const colors = require("colors");
const userRoutes = require("./routes/userRoutes");
const chatRoutes = require("./routes/chatRoutes");
const { notFound,errorHandler} = require("./middleware/errorMiddleware");
dotenv.config();
......@@ -20,7 +21,9 @@ app.get("/", (req, res) => {
res.send("API is Running Successfully");
});
//create API end points
app.use("/api/user", userRoutes);
app.use("/api/chat", chatRoutes);
//API Error Handling
app.use(notFound);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment