Dropdown multi select not maintaining after closing out

 type SortingKey =
    | "Duration"
    | "Favorited Territories"
    | "Favorited Offices"
    | "Requestable"
    | "Non-Requestable"
    | "Non-Full";

  const [sortingStates, setSortingStates] = useState<{
    [key in SortingKey]: boolean;
  }>({
    Duration: false,
    "Favorited Territories": false,
    "Favorited Offices": false,
    Requestable: false,
    "Non-Requestable": false,
    "Non-Full": false,
  });
const topContent = React.useMemo(() => {
    return (
      <div className="flex flex-col gap-4">
        <div className="flex flex-wrap justify-between items-center gap-4 w-full">
          {/* Dropdown for selecting search criteria */}
          <Dropdown>
            <DropdownTrigger>
              <Button size="sm" variant="flat">
                Search Criteria
              </Button>
            </DropdownTrigger>
            <DropdownMenu aria-label="Search Criteria" closeOnSelect>
              {columns
                .filter(
                  (column) =>
                    column.uid !== "actions" &&
                    column.uid !== "eventDate" &&
                    column.uid !== "eventType" &&
                    column.uid !== "startTime" &&
                    column.uid !== "favorited"
                )
                .map((column) => (
                  <DropdownItem
                    key={column.uid}
                    className="capitalize"
                    onClick={() => {
                      let lowercasedName = column.name.toLowerCase();
                      // Manually map column names to their corresponding values
                      if (lowercasedName === "office") {
                        setSearchCriteria("Office");
                        setFilterCriteria("officeName");
                      } else if (lowercasedName === "location") {
                        setSearchCriteria("Location");
                        setFilterCriteria("location");
                      } else if (lowercasedName === "territories") {
                        setSearchCriteria("Territories");
                        setFilterCriteria("territory");
                      } else if (lowercasedName === "specialty") {
                        setSearchCriteria("Specialties");
                        setFilterCriteria("specialty");
                      } else if (lowercasedName === "providers") {
                        setSearchCriteria("Providers");
                        setFilterCriteria("providers");
                      }

                      setSearchValue(""); // Clear the search input when changing criteria
                    }}
                  >
                    {column.name.toLowerCase()}
                  </DropdownItem>
                ))}
            </DropdownMenu>
          </Dropdown>

          {/* Search input */}
          <Input
            isClearable
            classNames={{
              base: "w-full sm:max-w-[44%]",
            }}
            placeholder={`Search by ` + searchCriteria}
            size="sm"
            startContent={
              <FontAwesomeIcon
                icon={faMagnifyingGlass}
                width="16"
                height="16"
              />
            }
            variant="underlined"
            value={searchValue}
            onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
              setSearchValue(e.target.value);
            }}
            classname="larger-text"
          />

          {/* Dropdown for Specialty */}
          <Dropdown>
            <DropdownTrigger>
              <Button size="sm" variant="flat">
                {filterSpecialty}
              </Button>
            </DropdownTrigger>
            <DropdownMenu
              aria-label="Specialty"
              closeOnSelect={true}
              style={{ maxHeight: "400px", overflowY: "auto" }}
            >
              {specialty_columns.map((specialty) => (
                <DropdownItem
                  key={specialty}
                  onClick={() => {
                    const value =
                      specialty === "Unselect Specialty"
                        ? "Select Specialty"
                        : specialty;
                    setFilterSpecialty(value);
                  }}
                >
                  {specialty}
                </DropdownItem>
              ))}
            </DropdownMenu>
          </Dropdown>

          {/* Dropdown for Type */}
          <Dropdown>
            <DropdownTrigger>
              <Button size="sm" variant="flat">
                {filterType}
              </Button>
            </DropdownTrigger>
            <DropdownMenu aria-label="Type" closeOnSelect={true}>
              {/* Map your types here */}
              {type_columns.map((type) => (
                <DropdownItem
                  key={type}
                  onClick={() => {
                    const value =
                      type === "Unselect Type" ? "Select Type" : type;
                    setFilterType(value);
                  }}
                >
                  {type}
                </DropdownItem>
              ))}
            </DropdownMenu>
          </Dropdown>

          <Dropdown>
            <DropdownTrigger>
              <Button size="sm" variant="flat">
                Sorting Options
              </Button>
            </DropdownTrigger>
            <DropdownMenu
              aria-label="Sort Criteria"
              closeOnSelect={false}
              selectionMode="multiple"
            >
              {SORTING_COLUMNS.map((column) => (
                <DropdownItem onClick={() => handleSortOptions(column)}>
                  {column}
                </DropdownItem>
              ))}
            </DropdownMenu>
          </Dropdown>
          <Dropdown>
            <DropdownTrigger className="hidden sm:flex px-6">
              <Button
                endContent={<FontAwesomeIcon icon={faChevronDown} />}
                size="sm"
                variant="flat"
              >
                Display Columns
              </Button>
            </DropdownTrigger>
            <DropdownMenu
              disallowEmptySelection
              aria-label="Table Columns"
              closeOnSelect={false}
              selectedKeys={visibleColumns}
              selectionMode="multiple"
              //This is to change the different columns shown, ignore error from typescript
              onSelectionChange={(newVisibleColumns) => {
                console.log(
                  "Attempting to update visible columns to:",
                  newVisibleColumns
                );

                if (newVisibleColumns.size > 0) {
                  setVisibleColumns(newVisibleColumns);
                } else {
                  //Can provide feedback that they need one box selected atleast here.
                }
              }}
            >
              {columns.map((column) => (
                <DropdownItem key={column.uid} className="capitalize">
                  {column.name.toLowerCase()}
                </DropdownItem>
              ))}
            </DropdownMenu>
          </Dropdown>
        </div>

        <div className="flex justify-between items-center">
          <span className="text-default-400 text-small">
            Total {meetings.length} meetings
          </span>
          <label className="flex items-center text-default-400 text-small">
            Rows per page:
            <select
              className="bg-transparent outline-none text-default-400 text-small"
              onChange={onRowsPerPageChange}
            >
              <option value="15">15</option>
              <option value="30">30</option>
              <option value="45">45</option>
            </select>
          </label>
        </div>
      </div>
    );
  }, [
    filterSpecialty,
    filterType,
    //setSortingStates,
    searchCriteria,
    searchValue,
    filterCriteria,
    visibleColumns,
    onRowsPerPageChange,
    meetings.length,
  ]);
return (
    <>
      <ProfileDrawer
        isOpen={drawerOpenOffice}
        onClose={() => setDrawerOpenOffice(false)}
        ID={officeModalId ? officeModalId : "null"}
      />
      <ProviderProfileDrawer
        isOpen={drawerOpenProviders}
        onClose={() => setDrawerOpenProviders(false)}
        providerAtEvent={providerInfo} //provider info
      />
      <div></div>
      <Table
        isCompact
        removeWrapper
        aria-label="Meetings table data"
        bottomContent={bottomContent}
        bottomContentPlacement="outside"
        //sortDescriptor={sortDescriptor}
        topContent={topContent}
        topContentPlacement="outside"
        //onSortChange={setSortDescriptor}
      >
        <TableHeader columns={headerColumns}>
          {(column) => (
            <TableColumn
              key={column.uid}
              align="center"
              allowsSorting={column.sortable}
            >
              <span className="larger-text">{column.name}</span>
            </TableColumn>
          )}
        </TableHeader>
        <TableBody emptyContent={"No meetings found"} items={items}>
          {(item) => (
            <TableRow key={item.id}>
              {(columnKey) => (
                <TableCell className="larger-text">
                  {renderCell(item, columnKey)}
                </TableCell>
              )}
            </TableRow>
          )}
        </TableBody>
      </Table>
    </>

Currently my Sorting Options dropdown allows me to select different options and it filters a table full of things by these options. The problem is when I click on some filters, then i close the sorting options list, the filters remain. However, when I open the sorting options list again, the filtered options arent selected.

Basically the check mark that appears near sorting options doesnt stay when I close it.

HTML canvas game giving error cant import outside of a module

The file that isn’t working is a js file and I’m trying to import a resource.js file to get the game objects loaded

SyntaxError: Cannot use import statement outside a module

If I remove that js import the same error pops up for my CSS stylesheet saying the same thing.
I’m on node 20.16.0 and I’m running the files in google chrome, but the error is happening even if I switch browsers.

I have looked through some forums and have made myself a live server which fixed my export problem I was having before this, but it didn’t help with the import statement. The import statement I’m using is:

import {Resources} from "./src/resources.js"
import './src/style.css'

I have the CSS linked with this in the area

<link rel="stylesheet" href="src/style.css"></link>

and I have the 2 js files linked with this:

<script src="src/resources.js" type="module"></script>
<script src="main.js"></script>

I’ve tried to flip the way I called the scripts in the html, I’ve tried calling both of them as modules or switching which of them was called as a module which resulted in an error saying it couldn’t fetch the files.

No friction on tweened sprite

I have a moving platform and box on top of it. No matter how fast the platform is moving, the box doesnt move sideways along with the platform and eventually falls down if the platform slipped away.

I tried different combinations of friction and frictionStatic.

   const box = this.matter.add.rectangle(700, ScreenHelper.sceneWrapperSize.height - 110, 20, 20, {
      collisionFilter: {
        category: CAT_BLOCK_A,
        mask: CAT_FLOOR,
        group: 0
      },
      friction: 1,
    })

    const platform = this.matter.add.sprite(664, ScreenHelper.sceneWrapperSize.height - 100, "brick", undefined, {
      isStatic: true,
      collisionFilter: {
        category: CAT_FLOOR,
        mask: CAT_PLAYER | CAT_PLAYER_BOTTOM_SENSOR | CAT_BLOCK_A,
        group: 0
      },
      friction: 1,
      frictionStatic: 1,
    });
    platform.setDisplaySize(200, 20)

    this.tweens.add({
      targets: platform,
      x: 300,
      ease: Phaser.Math.Easing.Quintic.InOut,
      duration: 3000,
      yoyo: true,
      repeat: -1
    });

Some computers browsers won’t allow me to login others do

I am tryingto login to a website and it has a login button but when clicked it just blinks and does nothing. Please hep.

I tried to clean up the cache,broswer history and disabled extensions. The website login work on many other computers and tablets but it also doesnt work on many other computers where it just doesnt beyond the login button. Clicking the login button just blinks and stays there.

What’s the difference between Map.groupBy and Object.groupBy?

JavaScript introduced two new methods: Map.groupBy and Object.groupBy. I understand that both are used to group a list of objects.

According to the documentation on MDN, Map.groupBy returns its results as a map and is useful when

The method is primarily useful when grouping elements that are associated with an object, and in particular when that object might change over time. If the object is invariant, you might instead represent it using a string, and group elements with Object.groupBy().

and Object.groupBy returns its results as an object and is useful when

This method should be used when group names can be represented by strings. If you need to group elements using a key that is some arbitrary value, use Map.groupBy() instead.

I don’t understand the reasoning behind these suggestions. Why shouldn’t someone just use Map.groupBy exclusively?

Created inputs are only submitting the first input’s value, while the rest are blank. Why?

This is a ToDoList project from TheOdinProject. I have been stuck on this part of code for days, as my inputs will console.log empty strings in the module createTodos. I can’t seem to figure out why the first input, name, would work, but the other 3 would not. Does anyone know why?

Module createProject.js

import { createTodos } from "./createTodos";

function appendInputsAndButton(currentProject) {
  let inputContainer = document.createElement("div");
  inputContainer.className = "input-container";

  inputContainer.innerHTML = `<input class="name"></input> <input class="description"></input>  <input class="dueDate"></input>  <input class="priority"></input>
         <button class="submit-todos">Submit</button> <button class="close">X</button> `;
  currentProject.appendChild(inputContainer);
  
  inputContainer.querySelector('.submit-todos').addEventListener('click', (event)=>{
    event.stopPropagation();
    createTodos();
  })

  inputContainer.querySelector('.close').addEventListener('click',()=>{
    currentProject.removeChild(inputContainer);
  } )
}



function makeProject(name) {
  return {
    name: name,
    todos: [],
  };
}

export let projects = [];
export function createProject() {
  projects.push(
    makeProject(document.querySelector("#projectName").value.trim())
  );
  console.log(projects);
  let archives = document.querySelector(".container");
  archives.innerHTML = "";
  for (let i = 0; i < projects.length; i++) {
    let project = projects[i];
    let newProject = document.createElement("div");
    newProject.className = "project";
    newProject.textContent = project.name;
    newProject.addEventListener("click", (e) => {
      let currentProject = e.target;
      appendInputsAndButton(currentProject);
    });
    archives.appendChild(newProject);
  }
}

Module 2 createTodos.js

import { projects } from "./createProject"

function makeTodos (name, description, dueDate, priority){
    return {
        name: name,
        description: description,
        dueDate: dueDate,
        priority: priority,
        
    }
}

export function createTodos(){
    console.log("createTodos function executed");
    const name = document.querySelector('.name').value;
    const description = document.querySelector('.description').value;
    const dueDate = document.querySelector('.dueDate').value;
    const priority = document.querySelector('.priority').value;

    console.log("Name:", name);
    console.log("Description:", description);
    console.log("Due Date:", dueDate);
    console.log("Priority:", priority);

    // projects[0] is just to test
    projects[0].todos.push(makeTodos);
    console.log("Updated Todos:", projects[0].todos);
}

Module 3 index.js

import './styles.css';
import {createProject} from './createProject.js'


const submitButton = document.querySelector('#submit-btn');
submitButton.addEventListener('click', ()=> {
    createProject();
})

JavaScript window.onscroll Not Working Properly on Mobile

I am trying to make a side button that extends an image and appears only when the user scrolls a certain no. of pixels. I have managed to do this before with another button but on desktop and on mobile, but this one doesn’t show after 20px, it shows up after scrolling for many times.

  let sidebtn = document.getElementById("side-arrow");

  // When the user scrolls down 20px from the top of the document, show the button
  window.onscroll = function() {scrollFunction()};
  function scrollFunction() {
       if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
           sidebtn.style.display = "block";
        } else {
           sidebtn.style.display = "none";
        }
        } 

I want to make it so that the button shows after 20px. Is there a better way to do this to get the same result.

How can I flip video with Web Task API [Javascript]?

i want to get mirror result of pose landmark,
before i work at python. this function give me mirror result.

mirror_image = = cv2.flip(raw, 1)

but,I couldn’t flip video in web development.

poseLandmarker.detectForVideo(video, startTimeMs, (result) => {drawlandmark code}

I found 3 ways to flip a video, but they didn’t work for my case.
CSS, video.style.transform= “scale(-1)”, canvasctx
It only flipped the viewing screen and did not apply to the original result.

I probably need to reverse the stream itself received from getUserMedia(), I need advice.

detechForVideo Image

getUserMedia Image

i tried 3 ways to flip video.
CSS, video.style flip, canvasctx. but it doesn’t work.

Since the video input is a pure stream, it seems that no changes are applied and the results are extracted as is.

detechForVideo video stream input what i want to change

How to Convert Styled-Components CSSObject into Inline Style Tag without React Context?

I am working on a Next.js project, and I need to convert a styled-components CSSObject into an inline tag. However, I do not want to use any React context for this purpose.

I tried the following code:


import { css } from 'styled-components';

css({});

But I encountered the following error:

Error: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
It appears that the styled-components library relies on a context that only functions in client components, but I am aiming for a server-side approach or any other method that doesn't involve React context.

How can I convert a styled-components CSSObject into an inline tag without using any React context?

AG Grid dynamic picture based on parsed data not used in another column?

I’m just learning AG Grid for the first time and if I understand correctly initialization of the table is parsing my data to populate the rows given the columns I’ve given. I would like to access a part of the current data being parsed to pass it to a custom image component to be used in the table. I’m not sure how to access this data or if it’s even possible. Any insight would be appreciated.

Current code:

export default function Table() {

    const [tableData, setTableData] = useState([])

    const fetchData = async() => {
        await fetch('https://api.fantasycalc.com/values/current?isDynasty=false&numQbs=1&numTeams=12&ppr=1')
        .then(res => res.json())
        .then(data => setTableData(data))
        .catch(err => console.log(err))
    }

    const CustomImageComponent = (id) => {
        var imgLink = 'https://a.espncdn.com/combiner/i?img=/i/headshots/nfl/players/full/'+{id}+'.png'
        return <a href={imgLink}>player image</a>
    }

    const [colDefs, setColDefs] = useState([
        { field: "overallRank" },
        { field: "player.name" },
        { field: "picture", 
            cellRenderer: CustomImageComponent(***need to pass id here***),
        }
      ]);

    //always runs first
    useEffect( () => {
        fetchData()
    },[]
    )

    return (
        // wrapping container with theme & size
        <div
         className="ag-theme-quartz" // applying the Data Grid theme
         style={{ height: 500 }} // the Data Grid will fill the size of the parent container
        >
          <AgGridReact
              rowData={tableData}
              columnDefs={colDefs}
          />
        </div>
       )
}

Example JSON object contained in tableData: (I need to access the player.espnId field)

{
"player": {
"id": 5494,
"name": "Christian McCaffrey",
"mflId": "13130",
"sleeperId": "4034",
"position": "RB",
"maybeBirthday": "1996-06-07",
"maybeHeight": "71",
"maybeWeight": 210,
"maybeCollege": "Stanford",
"maybeTeam": "SF",
"maybeAge": 28.2,
"maybeYoe": 7,
"espnId": "3117251",
"fleaflickerId": "12892"
},
"value": 10243,
"overallRank": 1,
"positionRank": 1,
}

I’ve tried using ValueGetter to supply the cellRenderer params but couldn’t get it to work. I think this is because ValueGetter is only for fields actually being used in the table, whereas I’m trying to access an ID not stored in the table.

Digital Root Function returns “undefined”

I’m new to programming!

Trying to write a function that obtains the digital root of a number.

Currently struggling with the “for loop” and “if else” portion of the formula that returns “undefined”. Can you please give me any feedback and explain where my errors are specifically?

function digitalRoot(n) {
  let sum = 0;// define variable for loop calculations
  let str = n.toString(10,'')// convert number into string
  if (str.length === 1) { // test if string length is more than 1 character
    return str * 1; // if 1 character, return that string value and convert it back to a number
    }
  else {
    return 
    let strArray = parseInt(str.split(','))// if more than 1 character, split string into individual characters & convert back to numbers
    for (let i = 0; i < strArray.length; i++) { // sum up the numbers and repeat until there is just a single digit result
      sum += strArray[i];
    }  
  }
}

Having trouble with stripe as it keeps making a new subscription for the user after every refresh

import Stripe from 'stripe';
import { NextResponse, NextRequest } from "next/server";

const stripeSecretKey = process.env.STRIPE_SECRET_KEY as string; 

const stripe = new Stripe(stripeSecretKey, {
     apiVersion: '2024-06-20',
});


export async function POST(req: NextRequest) {

  try {
    const data = await req.json();
    const { priceId, userId, email } = data;

    if (!userId) {
      throw new Error("User ID is not provided");
    }

    const customer = await stripe.customers.create({
      metadata: {
        userId: userId,
      },
      email: email
    });


    const subscription = await stripe.subscriptions.create({
      customer: customer.id,
      items: [{ price: priceId }], 
      payment_behavior: 'default_incomplete',
      collection_method: 'charge_automatically', 
      expand: ['latest_invoice.payment_intent'],
      payment_settings:{
        payment_method_types: ['card']
      }
    });

    const latestInvoice = subscription.latest_invoice;
    if (!latestInvoice || typeof latestInvoice === 'string') {
      throw new Error('Latest invoice is not available or is of unexpected type');
    }

    const paymentIntent = latestInvoice.payment_intent;
    if (!paymentIntent || typeof paymentIntent === 'string') {
      throw new Error('Payment intent is not available or is of unexpected type');
    }

    return NextResponse.json({ clientSecret: paymentIntent.client_secret }, { status: 200 });

  } catch (error) {
    console.error('Error creating subscription:', error);
    return NextResponse.json({ error: error }, { status: 400 });
  }
}
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /customers/{uid} {
      allow read, write: if request.auth != null && request.auth.uid == uid;

      match /checkout_sessions/{id} {
        allow read, write: if request.auth != null && request.auth.uid == uid;
      }
      match /subscriptions/{id} {
        allow read: if request.auth != null && request.auth.uid == uid;
      }
      match /payments/{id} {
        allow read: if request.auth != null && request.auth.uid == uid;
      }
    }

    match /products/{id} {
      allow read: if true;

      match /prices/{id} {
        allow read: if true;
      }

      match /tax_rates/{id} {
        allow read: if true;
      }
    }
  }
}
   
    const userRef = doc(db, "customers", userId);
    const userDoc = await getDoc(userRef);

    if (userDoc.exists()) {
      const userData = userDoc.data();
      if (userData.subscriptionId) {
       
        const subscriptionId = userData.subscriptionId;
        const subscription = await stripe.subscriptions.retrieve(subscriptionId, {
          expand: ['latest_invoice.payment_intent'],
        });

        if (subscription.latest_invoice && typeof subscription.latest_invoice !== 'string') {
          const paymentIntent = subscription.latest_invoice.payment_intent;

          if (paymentIntent && typeof paymentIntent !== 'string') {
            return NextResponse.json({ clientSecret: paymentIntent.client_secret }, { status: 200 });
          }
        }

        throw new Error('Payment intent not found or invalid');
      }
    }


Error creating subscription: [FirebaseError: Missing or insufficient permissions.] {
  code: 'permission-denied',
  customData: undefined,
  toString: [Function (anonymous)]
}
 POST /api/subscribe 400 in 147ms
Error creating subscription: [FirebaseError: Missing or insufficient permissions.] {
  code: 'permission-denied',
  customData: undefined,
  toString: [Function (anonymous)]
}
 POST /api/subscribe 400 in 147ms
[2024-08-11T21:41:23.341Z]  @firebase/firestore: Firestore (10.12.3): GrpcConnection RPC 'Listen' stream 0x3b35bbba error. Code: 1 Message: 1 CANCELLED: Disconnecting idle stream. Timed out waiting for new targets.
 GET /signUp 200 in 38ms
Error creating subscription: [FirebaseError: Missing or insufficient permissions.] {
  code: 'permission-denied',
  customData: undefined,
  toString: [Function (anonymous)]
}
 POST /api/subscribe 400 in 260ms
Error creating subscription: [FirebaseError: Missing or insufficient permissions.] {
  code: 'permission-denied',
  customData: undefined,
  toString: [Function (anonymous)]
}
 POST /api/subscribe 400 in 260ms
[2024-08-11T23:05:36.893Z]  @firebase/firestore: Firestore (10.12.3): GrpcConnection RPC 'Listen' stream 0x3b35bbbb error. Code: 1 Message: 1 CANCELLED: Disconnecting idle stream. Timed out waiting for new targets.

So Im trying to set up stripe payment for my project that I’m also using firebase to manage my auth. Im having trouble every time I load my /signUp page it will attempt to create two separate subscriptions, or if i refresh the page it will do the same thing i want it to create one subscription per user and then update that subscription. How would I do this.

I’ve adding the check above but getting a permission error

the first code is my subscribe api that is working but will create multiple subscription for a user including when refreshing the page

the second is my rules that i have in firestore

the third code was my attempt to include a check to see if a subscription attempt has been made on the user currently logged in

and the last bit is the error i was getting following

sorry this is my first time using stack so bare with me please

How can I reduce multiple lines in just only one

I have a query that returns data in this structure: name | age | idMessage.

So, I have results like that:

John | 34 | 1
John | 34 | 2
John | 34 | 3

So the query returns multiple lines but I need to deal with it to show just one line in my frontend with all idMessages separated by comma.

How can I agregate this data in just one line but with all idMessage values like that:
John | 34 | 1, 2, 3

I tried use filter but it not seems the best way to deal with it.

What’s Mean Immutability in javascript

So In Javascript Docs They Said The All Primitives Are Immutable

so my question is
when i write let x = 'foo';
x = 'bar';
is this mean that a foo Is In a spererate memory location
and bar in another memory location and the garbage collection will collect the old one which is foo

or is it just replacing the value of foo to bar in the same memory location which is firstly defined ?

Why would my PERN web applicaton deployed with Render only have the Server running and not the Client?

I’m running into an issue while trying to deploy my PERN application. The database is already set up and linked. The deployment process is not failing, but when you follow the link to the site it only is showing the json responses to the servers routes.

These are the scripts that I am using in my applications main package.json:

"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"build": "cd frontend && npm install && npm run build && cd ../backend && npm install",
"start": "node backend/server.js"
},

The build and start commands are what are used in the deployment. Here is how I am trying to connect my backend to the dist directory’s index.html file in backend/server.js:

”’

"use strict";

/** Server start up logic */
// Imports
const express = require('express');
const app = require("./app");
const { PORT } = require("./config");
const path = require('path');

app.use(express.static(path.join( __dirname, '..', 'frontend', 'dist')));

app.get('*', (req, res) => {
   res.sendFile(path.join( __dirname, '..', 'frontend', 'dist', 'index.html'));
});

app.listen(PORT, function() {
   console.log(`Started on Port:${PORT}`);
})

Since I am a novice, I don’t know what else may be useful to solve this problem. So please let me know where other trouble areas may be.