text: // external imports
  const express = require("express");
  const bodyParser = require("body-parser");
  const cookieParser = require("cookie-parser");
  
  // internal imports=
  const connectDB = require("./config/db");
  const { PORT } = require("./config");
  const authRoute = require("./routes/authRoutes");
  const errorhandler = require("./middlewares/errorhandler");
  
  const app = express();
  
  //connect database
  connectDB();
  
  // body paser
  app.use(bodyParser.json());
  
  // cookie parser
  app.use(cookieParser());
  
  // routes
  app.use("/api/user", authRoute);
  
  // 404 not found error
  app.get("*", function (req, res) {
    res.status(404).send("Not found");
  });
  
  // main error handling
  app.use(errorhandler);
  
  app.listen(PORT, () => {
    console.log(`app is running on port ${PORT}`);
  });
  