Repository: Code-the-Dream-School/ii-practicum-team-5-back
Pull request #37: Set up MongoDB connection
Author: login: Sisi-tech
Created: 2025-04-09T01:53:37Z | Merged: 2025-04-10T17:04:23Z

## Description

Set up database MongoDB connection

## Type of Changes

Set up database connection

## Update Screenshots

<img width="520" alt="Screenshot 2025-04-08 at 9 47 14 PM" src="https://github.com/user-attachments/assets/2d5beb08-b8bb-422a-ae96-f911397ec458" />

### Before
No database connection

### After
Connected to Database - MongoDB

## Testing Instructions
Run npm start 

## Installment
npm install mongoose dotenv

## .env 
**Please add the following MONGO_URI and PORT to your .env file to connect to MongoDB:** 

MONGO_URI=mongodb+srv://Praticum:Praticum@cluster0.rbltddn.mongodb.net/Team5?retryWrites=true&w=majority&appName=Cluster0
PORT=8000

Please Share your IP address with me on Slack to permit you to access the database.




Diff:
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index d866897..31f2945 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -4,7 +4,7 @@ _1) What does this PR do? 2) List out what you did._
 
 ## Related Issue
 
-_Provide a link to the related issue 
+\_Provide a link to the related issue
 
 ## Type of Changes
 
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9be5549..7dfea87 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -6,7 +6,7 @@ on:
     branches: [main]
   pull_request:
     types: [opened, reopened, synchronize]
-    branches: "**"
+    branches: '**'
 jobs:
   test:
     name: Check Code Formatting
diff --git a/.prettierrc b/.prettierrc
index aa26718..5714b81 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -5,4 +5,4 @@
   "printWidth": 120,
   "tabWidth": 2,
   "useTabs": false
-}
\ No newline at end of file
+}
diff --git a/README.md b/README.md
index 83fd512..9d3c20d 100644
--- a/README.md
+++ b/README.md
@@ -2,15 +2,15 @@
 
 This will be the API for the front-end React app part of your practicum project.
 
-These instructions are for the **front-end team** so they can setup their local development environment to run 
-both the back-end server and their front-end app. You can go through these steps during your first group meeting 
+These instructions are for the **front-end team** so they can setup their local development environment to run
+both the back-end server and their front-end app. You can go through these steps during your first group meeting
 in case you need assistance from your mentors.
 
->The back-end server will be running on port 8000. The front-end app will be running on port 3000. You will need to run both the back-end server and the front-end app at the same time to test your app.
+> The back-end server will be running on port 8000. The front-end app will be running on port 3000. You will need to run both the back-end server and the front-end app at the same time to test your app.
 
 ### Setting up local development environment
 
-1. Create a folder to contain both the front-end and back-end repos 
+1. Create a folder to contain both the front-end and back-end repos
 2. Clone this repository to that folder
 3. Run `npm install` to install dependencies
 4. Pull the latest version of the `main` branch (when needed)
@@ -27,4 +27,4 @@ Note: In the below example, the group's front-end repository was named `bb-pract
 
 ![browser server](images/back-end-running-browser.png)
 
->Update the .node-version file to match the version of Node.js the **team** is using. This is used by Render.com to [deploy the app](https://render.com/docs/node-version).
+> Update the .node-version file to match the version of Node.js the **team** is using. This is used by Render.com to [deploy the app](https://render.com/docs/node-version).
diff --git a/dist/app.js b/dist/app.js
new file mode 100644
index 0000000..86f4935
--- /dev/null
+++ b/dist/app.js
@@ -0,0 +1,27 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const express_1 = __importDefault(require("express"));
+const cors_1 = __importDefault(require("cors"));
+const express_favicon_1 = __importDefault(require("express-favicon"));
+const morgan_1 = __importDefault(require("morgan"));
+const mainRouter_1 = __importDefault(require("./routes/mainRouter"));
+const plans_1 = __importDefault(require("./routes/plans"));
+const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
+const yamljs_1 = __importDefault(require("yamljs"));
+const app = (0, express_1.default)();
+// middleware
+app.use((0, cors_1.default)());
+app.use(express_1.default.json());
+app.use(express_1.default.urlencoded({ extended: false }));
+app.use((0, morgan_1.default)('dev'));
+app.use(express_1.default.static('public'));
+app.use((0, express_favicon_1.default)(__dirname + '/public/favicon.ico'));
+// routes
+app.use('/api/v1', mainRouter_1.default);
+app.use('/api/v1/plans', plans_1.default);
+const swaggerDocument = yamljs_1.default.load('./swagger.yaml');
+app.use('/api-docs', swagger_ui_express_1.default.serve, swagger_ui_express_1.default.setup(swaggerDocument));
+exports.default = app;
diff --git a/dist/controllers/mainController.js b/dist/controllers/mainController.js
new file mode 100644
index 0000000..2b6e034
--- /dev/null
+++ b/dist/controllers/mainController.js
@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const mainController = (req, res) => {
+    res.json({
+        data: 'This is a full stack app!',
+    });
+};
+exports.default = mainController;
diff --git a/dist/controllers/plans.js b/dist/controllers/plans.js
new file mode 100644
index 0000000..6f5279a
--- /dev/null
+++ b/dist/controllers/plans.js
@@ -0,0 +1,111 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fetchCategoryWithPlans = exports.fetchUserWithPlans = exports.fetchPlan = exports.fetchAllPlans = void 0;
+const dummyData_json_1 = __importDefault(require("../dummyData.json"));
+const dummyPlans = dummyData_json_1.default.plans;
+const dummyStops = dummyData_json_1.default.stops;
+const dummyCategories = dummyData_json_1.default.categories;
+const dummyUsers = dummyData_json_1.default.users;
+const PAGE_SIZE = 10;
+const fetchAllPlans = (req, res) => {
+    const { categoryId, page = 1, size = PAGE_SIZE } = req.query;
+    let resultPlans = dummyPlans;
+    if (categoryId) {
+        resultPlans = resultPlans.filter((plan) => {
+            return plan.categoryId === categoryId;
+        });
+    }
+    // Pagination
+    const pageNumber = parseInt(page);
+    const pageSize = parseInt(size);
+    resultPlans = resultPlans.slice((pageNumber - 1) * pageSize, pageNumber * pageSize);
+    res.json({
+        ...(categoryId && { categoryId }),
+        page: pageNumber,
+        size: pageSize,
+        items: resultPlans,
+    });
+};
+exports.fetchAllPlans = fetchAllPlans;
+const fetchUserWithPlans = (req, res) => {
+    const { userId, page = 1, size = PAGE_SIZE } = req.params;
+    const user = dummyUsers.find((user) => {
+        return user.userId === userId;
+    });
+    if (!user) {
+        res.status(404).json({
+            error: `User with id ${userId} not found`,
+        });
+        return;
+    }
+    let resultPlans = dummyPlans;
+    resultPlans = resultPlans.filter((plan) => {
+        return plan.userId === userId;
+    });
+    // Pagination
+    const pageNumber = parseInt(page);
+    const pageSize = parseInt(size);
+    resultPlans = resultPlans.slice((pageNumber - 1) * pageSize, pageNumber * pageSize);
+    // eslint-disable-next-line @typescript-eslint/no-unused-vars
+    const { password, ...userWithoutPassword } = user;
+    res.json({
+        ...userWithoutPassword,
+        plans: {
+            page: pageNumber,
+            size: pageSize,
+            items: resultPlans,
+        },
+    });
+};
+exports.fetchUserWithPlans = fetchUserWithPlans;
+const fetchCategoryWithPlans = (req, res) => {
+    const { categoryId, page = 1, size = PAGE_SIZE } = req.params;
+    const category = dummyCategories.find((category) => {
+        return category.categoryId === categoryId;
+    });
+    if (!category) {
+        res.status(404).json({
+            error: `Category with id ${categoryId} not found`,
+        });
+        return;
+    }
+    let resultPlans = dummyPlans;
+    resultPlans = resultPlans.filter((plan) => {
+        return plan.categoryId === categoryId;
+    });
+    // Pagination
+    const pageNumber = parseInt(page);
+    const pageSize = parseInt(size);
+    resultPlans = resultPlans.slice((pageNumber - 1) * pageSize, pageNumber * pageSize);
+    res.json({
+        ...category,
+        plans: {
+            page: pageNumber,
+            size: pageSize,
+            items: resultPlans,
+        },
+    });
+};
+exports.fetchCategoryWithPlans = fetchCategoryWithPlans;
+const fetchPlan = (req, res) => {
+    const { planId } = req.params;
+    const plan = dummyPlans.find((plan) => {
+        return plan.planId === planId;
+    });
+    if (!plan) {
+        res.status(400).json({
+            error: `Plan with id ${planId} not found`,
+        });
+        return;
+    }
+    res.json({
+        ...plan,
+        stops: dummyStops.filter((stop) => {
+            return stop.planId === planId;
+        }),
+    });
+};
+exports.fetchPlan = fetchPlan;
diff --git a/dist/dummyData.json b/dist/dummyData.json
new file mode 100644
index 0000000..82d157e
--- /dev/null
+++ b/dist/dummyData.json
@@ -0,0 +1,372 @@
+{
+    "users": [
+        {
+            "userId": "jane-doe",
+            "name": "Jane Doe",
+            "email": "jane.doe@example.com",
+            "password": "hashed_password",
+            "pictureURL": "https://api.dicebear.com/9.x/dylan/svg?seed=jane-doe",
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "userId": "john-smith",
+            "name": "John Smith",
+            "email": "john.smith@example.com",
+            "password": "hashed_password",
+            "pictureURL": "https://api.dicebear.com/9.x/dylan/svg?seed=john-smith",
+            "createdAt": "2025-04-04T16:55:54Z",
+            "updatedAt": "2025-04-04T16:55:54Z"
+        },
+        {
+            "userId": "alice-johnson",
+            "name": "Alice Johnson",
+            "email": "alice.johnson@example.com",
+            "password": "hashed_password",
+            "pictureURL": "https://api.dicebear.com/9.x/dylan/svg?seed=alice-johnson",
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        }
+    ],
+    "categories": [
+        {
+            "categoryId": "city-exploration",
+            "name": "City Exploration",
+            "description": "Explore the city's landmarks, parks, museums, and dining spots.",
+            "imageURL": "https://dummyimage.com/1050x230/2196F3/fff.png",
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "categoryId": "urban-adventure",
+            "name": "Urban Adventure",
+            "description": "Discover the vibrant city life, parks, museums, and culinary delights.",
+            "imageURL": "https://dummyimage.com/1050x230/FF9800/fff.png",
+            "createdAt": "2025-04-04T16:55:54Z",
+            "updatedAt": "2025-04-04T16:55:54Z"
+        },
+        {
+            "categoryId": "academic-and-cultural-tour",
+            "name": "Academic and Cultural Tour",
+            "description": "Experience the academic atmosphere and cultural sites of Berkeley.",
+            "imageURL": "https://dummyimage.com/1050x230/673AB7/fff.png",
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "categoryId": "nature-and-history",
+            "name": "Nature and History",
+            "description": "Explore Berkeley’s parks, history, and natural beauty.",
+            "imageURL": "https://dummyimage.com/1050x230/8BC34A/fff.png",
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        }
+    ],
+    "plans": [
+        {
+            "planId": "san-francisco-day-tour",
+            "title": "San Francisco Day Tour",
+            "description": "A one-day tour exploring San Francisco's iconic sites, parks, museums, and dining establishments.",
+            "images": [
+                "https://dummyimage.com/390x265/2196F3/fff.png",
+                "https://dummyimage.com/390x265/FF9800/fff.png",
+                "https://dummyimage.com/390x265/673AB7/fff.png",
+                "https://dummyimage.com/390x265/8BC34A/fff.png"
+            ],
+            "type": "Full day",
+            "stopCount": 5,
+            "rating": 4.8,
+            "reviewCount": 120,
+            "startLocation": [37.7955, -122.3937],
+            "finishLocation": [37.7879, -122.4074],
+            "distance": 5.0,
+            "duration": "8 hours",
+            "userId": "jane-doe",
+            "categoryId": "city-exploration",
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "planId": "oakland-cultural-highlights",
+            "title": "Oakland Cultural Highlights",
+            "description": "A day exploring Oakland's cultural landmarks, parks, and dining spots.",
+            "images": [
+                "https://dummyimage.com/390x265/FF9800/fff.png",
+                "https://dummyimage.com/390x265/8BC34A/fff.png",
+                "https://dummyimage.com/390x265/673AB7/fff.png",
+                "https://dummyimage.com/390x265/3F51B5/fff.png",
+                "https://dummyimage.com/390x265/2196F3/fff.png"
+            ],
+            "type": "Mid day",
+            "stopCount": 4,
+            "rating": 4.7,
+            "reviewCount": 85,
+            "startLocation": [37.8014, -122.261],
+            "finishLocation": [37.7946, -122.277],
+            "distance": 4.5,
+            "duration": "7 hours",
+            "userId": "john-smith",
+            "categoryId": "urban-adventure",
+            "createdAt": "2025-04-04T16:55:54Z",
+            "updatedAt": "2025-04-04T16:55:54Z"
+        },
+        {
+            "planId": "berkeley-highlights-tour",
+            "title": "Berkeley Highlights Tour",
+            "description": "A day exploring the University of California, Berkeley campus and surrounding cultural spots.",
+            "images": ["https://dummyimage.com/390x265/673AB7/fff.png"],
+            "type": "Evening",
+            "stopCount": 4,
+            "rating": 4.9,
+            "reviewCount": 95,
+            "startLocation": [37.8719, -122.2585],
+            "finishLocation": [37.8793, -122.2698],
+            "distance": 3.0,
+            "duration": "6 hours",
+            "userId": "alice-johnson",
+            "categoryId": "academic-and-cultural-tour",
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "planId": "berkeley-nature-history-tour",
+            "title": "Berkeley Nature & History Tour",
+            "description": "A day exploring Berkeley’s natural beauty, parks, and historical sites.",
+            "images": [
+                "https://dummyimage.com/390x265/8BC34A/fff.png",
+                "https://dummyimage.com/390x265/7C4A2/fff.png",
+                "https://dummyimage.com/390x265/FF9800/fff.png"
+            ],
+            "type": "Night",
+            "stopCount": 5,
+            "rating": 4.8,
+            "reviewCount": 62,
+            "startLocation": [37.8747, -122.2627],
+            "finishLocation": [37.8712, -122.3021],
+            "distance": 5.5,
+            "duration": "7 hours",
+            "userId": "alice-johnson",
+            "categoryId": "nature-and-history",
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        }
+    ],
+    "stops": [
+        {
+            "stopId": "stop-001",
+            "planId": "san-francisco-day-tour",
+            "name": "Ferry Building Marketplace",
+            "imageURL": "https://dummyimage.com/390x265/2196F3/fff.png",
+            "address": "1 Ferry Building, San Francisco, CA 94111",
+            "description": "A historic building offering a variety of food vendors, shops, and a farmers market.",
+            "location": [37.7955, -122.3937],
+            "sequence": 1,
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "stopId": "stop-002",
+            "planId": "san-francisco-day-tour",
+            "name": "Exploratorium",
+            "imageURL": "https://dummyimage.com/390x265/FF9800/fff.png",
+            "address": "Pier 15, The Embarcadero, San Francisco, CA 94111",
+            "description": "A museum of science, technology, and arts with interactive exhibits.",
+            "location": [37.8014, -122.3977],
+            "sequence": 2,
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "stopId": "stop-003",
+            "planId": "san-francisco-day-tour",
+            "name": "Coit Tower",
+            "imageURL": "https://dummyimage.com/390x265/673AB7/fff.png",
+            "address": "1 Telegraph Hill Blvd, San Francisco, CA 94133",
+            "description": "An art deco tower offering panoramic views of the city and bay.",
+            "location": [37.8024, -122.4058],
+            "sequence": 3,
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "stopId": "stop-004",
+            "planId": "san-francisco-day-tour",
+            "name": "Ghirardelli Square",
+            "imageURL": "https://dummyimage.com/390x265/8BC34A/fff.png",
+            "address": "900 North Point St, San Francisco, CA 94109",
+            "description": "A landmark public square with shops and restaurants, known for its chocolate.",
+            "location": [37.8058, -122.4227],
+            "sequence": 4,
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "stopId": "stop-005",
+            "planId": "san-francisco-day-tour",
+            "name": "Union Square",
+            "imageURL": "https://dummyimage.com/390x265/2196F3/fff.png",
+            "address": "333 Post St, San Francisco, CA 94108",
+            "description": "A bustling hub with shopping, hotels, and theaters.",
+            "location": [37.7879, -122.4074],
+            "sequence": 5,
+            "createdAt": "2025-04-04T16:50:54Z",
+            "updatedAt": "2025-04-04T16:50:54Z"
+        },
+        {
+            "stopId": "stop-006",
+            "planId": "oakland-cultural-highlights",
+            "name": "Lake Merritt",
+            "imageURL": "https://dummyimage.com/390x265/8BC34A/fff.png",
+            "address": "Lake Merritt Blvd, Oakland, CA 94612",
+            "description": "A large tidal lagoon in the center of Oakland, surrounded by parkland and city neighborhoods.",
+            "location": [37.8014, -122.261],
+            "sequence": 1,
+            "createdAt": "2025-04-04T16:55:54Z",
+            "updatedAt": "2025-04-04T16:55:54Z"
+        },
+        {
+            "stopId": "stop-007",
+            "planId": "oakland-cultural-highlights",
+            "name": "Oakland Museum of California",
+            "imageURL": "https://dummyimage.com/390x265/FF9800/fff.png",
+            "address": "1000 Oak St, Oakland, CA 94607",
+            "description": "A museum dedicated to the art, history, and natural science of California.",
+            "location": [37.7986, -122.2655],
+            "sequence": 2,
+            "createdAt": "2025-04-04T16:55:54Z",
+            "updatedAt": "2025-04-04T16:55:54Z"
+        },
+        {
+            "stopId": "stop-008",
+            "planId": "oakland-cultural-highlights",
+            "name": "Chinatown",
+            "imageURL": "https://dummyimage.com/390x265/673AB7/fff.png",
+            "address": "Webster St & 8th St, Oakland, CA 94607",
+            "description": "A bustling neighborhood known for its Asian markets, eateries, and cultural shops.",
+            "location": [37.798, -122.267],
+            "sequence": 3,
+            "createdAt": "2025-04-04T16:55:54Z",
+            "updatedAt": "2025-04-04T16:55:54Z"
+        },
+        {
+            "stopId": "stop-009",
+            "planId": "oakland-cultural-highlights",
+            "name": "Jack London Square",
+            "imageURL": "https://dummyimage.com/390x265/3F51B5/fff.png",
+            "address": "472 Water St, Oakland, CA 94607",
+            "description": "A waterfront area with shops, restaurants, and ferry access, named after the author Jack London.",
+            "location": [37.7946, -122.277],
+            "sequence": 4,
+            "createdAt": "2025-04-04T16:55:54Z",
+            "updatedAt": "2025-04-04T16:55:54Z"
+        },
+        {
+            "stopId": "stop-010",
+            "planId": "berkeley-highlights-tour",
+            "name": "UC Berkeley Campus",
+            "imageURL": "https://dummyimage.com/390x265/8BC34A/fff.png",
+            "address": "Berkeley, CA 94720",
+            "description": "One of the world’s leading public research universities with beautiful architecture and public spaces.",
+            "location": [37.8719, -122.2585],
+            "sequence": 1,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-011",
+            "planId": "berkeley-highlights-tour",
+            "name": "The Lawrence Hall of Science",
+            "imageURL": "https://dummyimage.com/390x265/7C4A2/fff.png",
+            "address": "1 Centennial Dr, Berkeley, CA 94720",
+            "description": "A family-friendly science center with hands-on exhibits and great views of the Bay Area.",
+            "location": [37.8796, -122.2477],
+            "sequence": 2,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-012",
+            "planId": "berkeley-highlights-tour",
+            "name": "Berkeley Art Museum and Pacific Film Archive (BAMPFA)",
+            "imageURL": "https://dummyimage.com/390x265/673AB7/fff.png",
+            "address": "2155 Center St, Berkeley, CA 94720",
+            "description": "A cultural institution offering film screenings and contemporary art exhibitions.",
+            "location": [37.8702, -122.267],
+            "sequence": 3,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-013",
+            "planId": "berkeley-highlights-tour",
+            "name": "Gourmet Ghetto",
+            "imageURL": "https://dummyimage.com/390x265/8BC34A/fff.png",
+            "address": "Shattuck Ave & Vine St, Berkeley, CA 94709",
+            "description": "A foodie district with iconic restaurants and cafes like Chez Panisse and Cheeseboard Pizza.",
+            "location": [37.8793, -122.2698],
+            "sequence": 4,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-014",
+            "planId": "berkeley-nature-history-tour",
+            "name": "Berkeley Rose Garden",
+            "imageURL": "https://dummyimage.com/390x265/fF9800/fff.png",
+            "address": "1200 Euclid Ave, Berkeley, CA 94708",
+            "description": "A beautiful terraced garden with over 3,000 rose bushes, offering panoramic views of the Bay Area.",
+            "location": [37.8747, -122.2627],
+            "sequence": 1,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-015",
+            "planId": "berkeley-nature-history-tour",
+            "name": "Tilden Regional Park",
+            "imageURL": "https://dummyimage.com/390x265/gfF9800/fff.png",
+            "address": "2501 Grizzly Peak Blvd, Berkeley, CA 94708",
+            "description": "A large park with hiking trails, a lake, and the famous steam train for a family-friendly experience.",
+            "location": [37.8697, -122.2647],
+            "sequence": 2,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-016",
+            "planId": "berkeley-nature-history-tour",
+            "name": "Berkeley Firestorm Memorial",
+            "imageURL": "https://dummyimage.com/390x265/FF9800/fff.png",
+            "address": "2282 Shattuck Ave, Berkeley, CA 94704",
+            "description": "A memorial dedicated to the victims and survivors of the 1991 firestorm in Berkeley.",
+            "location": [37.8671, -122.2696],
+            "sequence": 3,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-017",
+            "planId": "berkeley-nature-history-tour",
+            "name": "University of California Botanical Garden",
+            "imageURL": "https://dummyimage.com/390x265/8BC34A/fff.png",
+            "address": "200 Centennial Dr, Berkeley, CA 94720",
+            "description": "A botanical garden with over 13,000 types of plants from around the world, perfect for nature lovers.",
+            "location": [37.8742, -122.2592],
+            "sequence": 4,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        },
+        {
+            "stopId": "stop-018",
+            "planId": "berkeley-nature-history-tour",
+            "name": "Berkeley Marina",
+            "imageURL": "https://dummyimage.com/390x265/2196F3/fff.png",
+            "address": "201 University Ave, Berkeley, CA 94710",
+            "description": "A waterfront area offering scenic views, walking paths, and great spots for picnicking and relaxing.",
+            "location": [37.8712, -122.3021],
+            "sequence": 5,
+            "createdAt": "2025-04-04T17:00:54Z",
+            "updatedAt": "2025-04-04T17:00:54Z"
+        }
+    ]
+}
diff --git a/dist/dummyDataTypes.js b/dist/dummyDataTypes.js
new file mode 100644
index 0000000..60a7591
--- /dev/null
+++ b/dist/dummyDataTypes.js
@@ -0,0 +1,3 @@
+"use strict";
+// Global and accessible types in the codebase without importing!
+Object.defineProperty(exports, "__esModule", { value: true });
diff --git a/dist/routes/mainRouter.js b/dist/routes/mainRouter.js
new file mode 100644
index 0000000..aa160ac
--- /dev/null
+++ b/dist/routes/mainRouter.js
@@ -0,0 +1,10 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const express_1 = __importDefault(require("express"));
+const mainController_1 = __importDefault(require("../controllers/mainController"));
+const router = express_1.default.Router();
+router.get('/', mainController_1.default);
+exports.default = router;
diff --git a/dist/routes/plans.js b/dist/routes/plans.js
new file mode 100644
index 0000000..edb00d4
--- /dev/null
+++ b/dist/routes/plans.js
@@ -0,0 +1,13 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const express_1 = __importDefault(require("express"));
+const plans_1 = require("../controllers/plans");
+const router = express_1.default.Router();
+router.route('/').get(plans_1.fetchAllPlans);
+router.route('/plan/:planId').get(plans_1.fetchPlan);
+router.route('/user/:userId').get(plans_1.fetchUserWithPlans);
+router.route('/category/:categoryId').get(plans_1.fetchCategoryWithPlans);
+exports.default = router;
diff --git a/dist/server.js b/dist/server.js
new file mode 100644
index 0000000..920e9d6
--- /dev/null
+++ b/dist/server.js
@@ -0,0 +1,9 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const { PORT = 8000 } = process.env;
+const app_1 = __importDefault(require("./app"));
+const listener = () => console.log(`Listening on Port ${PORT}!`);
+app_1.default.listen(PORT, listener);
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 9a9ac0a..f4c3e26 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -1,7 +1,7 @@
 import globals from 'globals'
 import js from '@eslint/js'
-import ts from '@typescript-eslint/eslint-plugin';
-import tsParser from '@typescript-eslint/parser';
+import ts from '@typescript-eslint/eslint-plugin'
+import tsParser from '@typescript-eslint/parser'
 import pluginReact from 'eslint-plugin-react'
 import pluginPrettier from 'eslint-plugin-prettier'
 import configPrettier from 'eslint-config-prettier'
@@ -14,8 +14,8 @@ export default [
       parser: tsParser,
       parserOptions: {
         project: './tsconfig.json',
-        sourceType: 'module'
-      }
+        sourceType: 'module',
+      },
     },
   },
   {
@@ -30,12 +30,12 @@ export default [
   },
   {
     files: ['**/*.{js,mjs,cjs,jsx,ts,tsx}'],
-    plugins: { 'react': pluginReact },
+    plugins: { react: pluginReact },
     rules: pluginReact.configs.flat.recommended.rules,
   },
   {
     files: ['**/*.{js,mjs,cjs,jsx,ts,tsx}'],
-    plugins: { 'prettier': pluginPrettier },
+    plugins: { prettier: pluginPrettier },
     rules: {
       ...configPrettier.rules, // Disable conflicting ESLint rules
       'prettier/prettier': 'error', // Treat Prettier formatting issues as ESLint errors
diff --git a/package-lock.json b/package-lock.json
index afc1a69..39116a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,11 +1,11 @@
 {
-  "name": "bb-practicum-team-1-back",
+  "name": "clear",
   "version": "1.0.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
-      "name": "bb-practicum-team-1-back",
+      "name": "clear",
       "version": "1.0.0",
       "license": "ISC",
       "dependencies": {
@@ -13,12 +13,12 @@
         "@types/morgan": "^1.9.9",
         "bcryptjs": "^2.4.3",
         "cors": "^2.8.5",
-        "dotenv": "^16.4.5",
-        "express": "^4.18.2",
+        "dotenv": "^16.4.7",
+        "express": "^4.21.2",
         "express-favicon": "^2.0.4",
         "http-status-codes": "^2.3.0",
         "jsonwebtoken": "^9.0.2",
-        "mongodb": "^6.10.0",
+        "mongodb": "^6.15.0",
         "mongoose": "^7.8.2",
         "morgan": "^1.10.0",
         "swagger-ui-express": "^5.0.1",
@@ -42,7 +42,7 @@
         "nodemon": "^3.1.9",
         "prettier": "^3.2.5",
         "ts-node": "^10.9.2",
-        "typescript": "^5.8.2",
+        "typescript": "^5.8.3",
         "typescript-eslint": "^8.28.0"
       }
     },
@@ -6434,9 +6434,9 @@
       }
     },
     "node_modules/typescript": {
-      "version": "5.8.2",
-      "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
-      "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
+      "version": "5.8.3",
+      "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
+      "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
       "dev": true,
       "license": "Apache-2.0",
       "bin": {
diff --git a/package.json b/package.json
index bed5c78..30293f7 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
 {
-  "name": "bb-practicum-team-1-back",
+  "name": "clear",
   "version": "1.0.0",
   "description": "Back-End Repo for Team 1 of Baboon/Bald Eagle Practicum",
   "main": "app.js",
@@ -19,12 +19,12 @@
     "@types/morgan": "^1.9.9",
     "bcryptjs": "^2.4.3",
     "cors": "^2.8.5",
-    "dotenv": "^16.4.5",
-    "express": "^4.18.2",
+    "dotenv": "^16.4.7",
+    "express": "^4.21.2",
     "express-favicon": "^2.0.4",
     "http-status-codes": "^2.3.0",
     "jsonwebtoken": "^9.0.2",
-    "mongodb": "^6.10.0",
+    "mongodb": "^6.15.0",
     "mongoose": "^7.8.2",
     "morgan": "^1.10.0",
     "swagger-ui-express": "^5.0.1",
@@ -48,7 +48,16 @@
     "nodemon": "^3.1.9",
     "prettier": "^3.2.5",
     "ts-node": "^10.9.2",
-    "typescript": "^5.8.2",
+    "typescript": "^5.8.3",
     "typescript-eslint": "^8.28.0"
-  }
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/Code-the-Dream-School/ii-practicum-team-5-back.git"
+  },
+  "bugs": {
+    "url": "https://github.com/Code-the-Dream-School/ii-practicum-team-5-back/issues"
+  },
+  "homepage": "https://github.com/Code-the-Dream-School/ii-practicum-team-5-back#readme",
+  "keywords": []
 }
diff --git a/src/db/connection.ts b/src/db/connection.ts
new file mode 100644
index 0000000..583801a
--- /dev/null
+++ b/src/db/connection.ts
@@ -0,0 +1,23 @@
+import mongoose from 'mongoose'
+import dotenv from 'dotenv'
+
+dotenv.config()
+
+const connectDB = (url: string) => {
+  if (!url) {
+    throw new Error('Database connection string is undefined. Check your environment variables.')
+  }
+  return mongoose
+    .connect(url, {
+      serverSelectionTimeoutMS: 5000,
+    })
+    .then(() => {
+      console.log('Connected to the DB ...')
+    })
+    .catch((error: string) => {
+      console.error('Database connection Error: ', error)
+      process.exit(1)
+    })
+}
+
+export { connectDB }
diff --git a/src/model/user.ts b/src/model/user.ts
new file mode 100644
index 0000000..076186c
--- /dev/null
+++ b/src/model/user.ts
@@ -0,0 +1,54 @@
+// import mongoose from 'mongoose'
+// import bcrypt from 'bcryptjs'
+// import jwt from 'jsonwebtoken'
+
+// const UserSchema = new mongoose.Schema(
+//   {
+//     firstName: {
+//       type: String,
+//       trim: true,
+//       required: [true, 'Please provide your first name.'],
+//       minlength: 1,
+//       maxlength: 50,
+//     },
+//     lastName: {
+//       type: String,
+//       trim: true,
+//       required: [true, 'Please provide your last name.'],
+//       minlength: 1,
+//       maxlength: 50,
+//     },
+//     email: {
+//       type: String,
+//       required: [true, 'Please provide email address.'],
+//       match: [
+//         /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
+//         'Please provide a valid email',
+//       ],
+//       lowercase: true,
+//       unique: true,
+//       index: true,
+//     },
+//     password: {
+//       type: String,
+//       required: [true, 'Please provide password.'],
+//       minlength: 8,
+//       validate: {
+//         validator: function (value: string) {
+//           return /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/.test(value)
+//         },
+//         message: 'Password must include at least one uppercase letter, one lowercase letter, and one number',
+//       },
+//     },
+//     confirmPassword: {
+//       type: String,
+//       validate: {
+//         validator: function (value: string) {
+//           return value === this.password
+//         },
+//         message: 'Password does not match.',
+//       },
+//     },
+//   },
+//   { timestamps: true }
+// )
diff --git a/src/server.ts b/src/server.ts
index 2f0563a..9562ab1 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -1,5 +1,19 @@
+import dotenv from 'dotenv'
+dotenv.config()
 const { PORT = 8000 } = process.env
 import app from './app'
+import { connectDB } from './db/connection'
 
-const listener = () => console.log(`Listening on Port ${PORT}!`)
-app.listen(PORT, listener)
+const listener = async () => {
+  try {
+    await connectDB(`${process.env.MONGO_URI}`)
+    app.listen(PORT, () => {
+      console.log(`Server is listening on port ${PORT}...`)
+    })
+  } catch (error) {
+    console.error(error)
+    process.exit(1)
+  }
+}
+
+listener()
diff --git a/swagger.yaml b/swagger.yaml
index 2d3f1f2..9f22194 100644
--- a/swagger.yaml
+++ b/swagger.yaml
@@ -240,4 +240,4 @@ security:
   - httpBearer: []
 tags:
   - name: Plans
-    description: ''
\ No newline at end of file
+    description: ''
diff --git a/tsconfig.json b/tsconfig.json
index bf5f054..d164ae6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -6,10 +6,11 @@
     "rootDir": "./src",
     "strict": true,
     "resolveJsonModule": true,
+    "moduleResolution": "Node",
     "esModuleInterop": true,
     "skipLibCheck": true,
     "forceConsistentCasingInFileNames": true
   },
   "include": ["src/**/*.ts"],
   "exclude": ["node_modules"]
-}
\ No newline at end of file
+}


Reviews:
user: login: up2code3
body: in the package json the "format": key needs to keep the value "npm run prettier:fix && npm run lint:fix"
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-09T13:43:45Z
user: login: up2code3
body: NICE WORK!
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-09T23:28:25Z
user: login: rezahedi
body: The database connection looks good to me.
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-10T15:16:26Z
user: login: conquerorabhishek
body: Let's merge this so that everyone can take advantage of this.
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-10T16:30:07Z

Review comments:
path: dist/app.js
user: login: rezahedi
body: The /dist folder shouldn't be committed to the repo — it's usually a build artifact and should be ignored by Git.
Please remove /dist from your git by `git rm -r --cached dist`, then add /dist to your .gitignore file and commit changes.
Also, make sure to review your staged files before committing. It's best practice to selectively stage only the files you actually want to include in the commit.
created_at: 2025-04-10T14:56:25Z
author_association: COLLABORATOR
path: dist/controllers/mainController.js
user: login: rezahedi
body: This file too, and the others in the /dist folder, shouldn't be in the repo.
As mentioned in the previous comment, it looks like you staged everything at once. In the future, try to selectively stage only the files needed for the commit. This helps avoid committing build or temporary files by mistake.
created_at: 2025-04-10T15:00:32Z
author_association: COLLABORATOR
path: src/model/user.ts
user: login: rezahedi
body: Refer to my previous comment — if you don’t want a file to be part of your commit, make sure not to stage it in the first place.
Just a heads-up: if you're not comfortable with the terminal, VSCode has a great built-in Source Control panel. It lets you easily view, stage, and unstage files before committing, which can help avoid situations like this.
created_at: 2025-04-10T15:09:53Z
author_association: COLLABORATOR

PR comments:
user: login: up2code3
created_at: 2025-04-09T13:37:43Z
body: hey SiSi, so a few things. 

1) there should have been a value for MONGO_URI in your .env file. We need to either A , update the readme and put it in there, or B share it on the slack channel. Every one will use the same string, So we all are connecting to the same database.

2) on the package.json the script for format needs to stay as it was ( lint and prettier ) , when you are all done with your work and ready to add/commit/push, Run npm run format before you do that and it will catch and fix any and all format errors.
author_association: COLLABORATOR
user: login: Sisi-tech
created_at: 2025-04-09T13:50:39Z
body: Do we have to use the same URL for it? I don't feel comfortable sharing mine since it has my account password. I thought we could use our own MongoDB account and password. 
author_association: COLLABORATOR
user: login: up2code3
created_at: 2025-04-09T13:53:45Z
body: Good Job on 
connection.ts
server.ts
they look great!!!

author_association: COLLABORATOR
user: login: up2code3
created_at: 2025-04-09T14:01:08Z
body: So for the connection string, all the plans and users when created or edited or deleted are done at/in the database you created on mongo db. I could be wrong but I do not think there is a way to connect to your personal mongo db and then connect to another users database. So there is a few options, We could have someone else create the database at mongodb and they could share the string. Or , let me talk to Frank and see if he knows a better way to explain it that makes you feel comfortable sharing it. I totally understand where you are coming form. 

author_association: COLLABORATOR
user: login: Sisi-tech
created_at: 2025-04-09T14:01:14Z
body: > in the package json the "format": key needs to keep the value "npm run prettier:fix && npm run lint:fix"

This has been changed. 
author_association: COLLABORATOR
user: login: up2code3
created_at: 2025-04-09T14:01:35Z
body: for the commenting out the user model, are you making that on a different branch? 

author_association: COLLABORATOR
user: login: Sisi-tech
created_at: 2025-04-09T14:04:38Z
body: > for the commenting out the user model, are you making that on a different branch?

Yes. I'll create a new one for the User model when I finish. I have to comment it out at this moment since it is not completed yet and causes the error when I push the code to this branch. 
author_association: COLLABORATOR
user: login: up2code3
created_at: 2025-04-09T14:15:49Z
body: Aye I think i have a plan, SO the thing you are uncomfortable about is the string has your actual user name and password in it right?

author_association: COLLABORATOR
user: login: Sisi-tech
created_at: 2025-04-09T14:20:03Z
body: > Aye I think i have a plan, SO the thing you are uncomfortable about is the string has your actual user name and password in it right?

I just shared it on Slack. it's fine. I don't want it to be too complicated for others. especially for the front-end team. 
author_association: COLLABORATOR
user: login: up2code3
created_at: 2025-04-09T14:33:34Z
body: sign in to mongodb in your browser.

> Database Access (left window panel)
> + ADD NEW DATABASE USER (green button on top right)
>auth Method = Password
> Add team5 as username  ( or similar )
> Add password ( simple is fine )
> Add Built In Role (select Read and Write)
> Finally click add user

Now 
> Clusters ( left window panel )
> click Connect ( grey button in middle )
> select the new user we just created
> then copy the string on the right (connection instructions)

mongodb+srv://Team5:<db_password>@nodeexpresscourse.qg7hric.mongodb.net/?retryWrites=true&w=majority&appName=NodeExpressCourse

now it looks like this , instead of your personal name and password it is Team5 and the Password you created for team5. The Main catch is the Built in roles you select when you create the Team5 user on your account, the team5 user will only be able to do read and write things to the documents. As opposed to picking the option above read and write, which is Atlas admin, that means Team5 user would have Admin access, so don't select that , lol.

How does this sound? if you need help lemme know and we can do a quick huddle and walk through it,


author_association: COLLABORATOR
user: login: up2code3
created_at: 2025-04-09T14:34:44Z
body: Btw , after you create team5 and get the string , test it locally and make sure it is still connecting with the "new user"
author_association: COLLABORATOR