How can I use my react build in fastify?

Hi I have a server with apollo sever fastify and I want to use my react build for front-end, What should I do?

import path from "path";

import fs, { existsSync, mkdirSync } from "fs";

import { ApolloServerPlugin } from "apollo-server-plugin-base";

import dynamodbStore from "connect-dynamodb";

import schema from "./schema";

import fastify from "fastify";

import { ApolloServer } from "apollo-server-fastify";

import fastifySession from "@fastify/session";

import fastifyCookie from "fastify-cookie";

import fastifyStatic from "fastify-static";

import { processRequest } from "graphql-upload";

import { getLACurrentDateTime } from "./controllers/Dashboard";

const PORT = process.env.PORT || 5000;

const env = process.env.NODE_ENV || "development";

const myPlugin: ApolloServerPlugin<Record<string, string>> = {

  async requestDidStart(requestContext) {

    let start = Date.now();

    fs.appendFile(

      path.join(

        __dirname,

        "../logs",

        `${getLACurrentDateTime().toFormat("MM-dd-yyyy")}.txt`

      ),

      `request started

          ${JSON.stringify(requestContext.request.query)}

          ${JSON.stringify(requestContext.request.variables)}

          `,

      (err) => {}

    );

    return {

      async didEncounterErrors(requestContext) {

        fs.appendFile(

          path.join(

            __dirname,

            "../logs",

            `error${getLACurrentDateTime().toFormat("MM-dd-yyyy")}.txt`

          ),

          `an error happened in response to query

                              ${JSON.stringify(requestContext.request.query)}

                              ${JSON.stringify(requestContext.errors)}

                              Time ${getLACurrentDateTime().toISO()}

                              `,

          (err) => {}

        );

      },

      async willSendResponse(requestContext) {

        const time = Date.now() - start;

        fs.appendFile(

          path.join(

            __dirname,

            "../logs",

            `${getLACurrentDateTime().toFormat("MM-dd-yyyy")}.txt`

          ),

          `response sent

                          ${JSON.stringify(requestContext.response)}

                          request time ${getLACurrentDateTime().toISO()}

                          request duration ${time}

                          `,

          (err) => {}

        );

      },

    };

  },

};

const app = fastify();

const server = new ApolloServer({

  schema,

  context: ({ request }) => {

    const auth = request.headers.authorization || "";

    return {

      auth,

      session: request.session,

    };

  },

  plugins: [myPlugin],

});

const corsOptions = {

  origin:

    env === "production"

      ? ["http://localhost:3000"]

      : true,

  optionsSuccessStatus: 200,

  credentials: true,

};

app.register(fastifyCookie);

app.register(fastifySession, {

  secret:

    "secret",

  saveUninitialized: false,

  cookieName: "GraphSSid5",

  cookie: {

    maxAge: 60 * 60 * 24 * 1000 * 7,

    secure: false,

    sameSite: true,

  },

});

existsSync(path.join(__dirname, "../files")) ||

  mkdirSync(path.join(__dirname, "../files"));

existsSync(path.join(__dirname, "../templates")) ||

  mkdirSync(path.join(__dirname, "../templates"));

existsSync(path.join(__dirname, "../logs")) ||

  mkdirSync(path.join(__dirname, "../logs"));

app.register(fastifyStatic, {

  root: path.join(__dirname, "../files"),

  prefix: "/files",

});

app.register(fastifyStatic, {

  root: path.join(__dirname, "../templates"),

  prefix: "/templates",

  decorateReply: false, // the reply decorator has been added by the first plugin registration

});

app.addContentTypeParser("multipart", (request: any, payload, done) => {

  request.isMultipart = true;

  done(null);

});

// Format the request body to follow graphql-upload's

app.addHook("preValidation", async function (request: any, reply) {

  if (!request.isMultipart) {

    return;

  }

  request.body = await processRequest(request.raw, reply.raw);

});

app.get("*", (req, res) => {

  res.sendFile("index.html", path.join(__dirname, "build/index.html"));

});

server.start().then(() => {

  app.register(server.createHandler({ path: "/graphql", cors: corsOptions }));

  app.listen(PORT, "0.0.0.0", () => {

    console.log(`Server is ready at port 5000`);

  });

});