Search code examples
node.jsreactjshostingshared-hosting

How to deploy node + react App on goDaddy shared hosting


I am trying to deploy react and nodejs app on GoDaddy hosting but its just showing nodejs output,

I am serving my build folder like this

if (process.env.NODE_ENV === "production") {
    app.use(express.static(path.join(__dirname, 'build')));
    app.get("/*", (req, res) => {
        res.sendFile(path.join(__dirname, 'build', 'index.html'));
    });
}

still react app isn't showing up


Solution

  • i had the same problem with this. i just removed the if condition and its started working fine because the if condition process.env.NODE_ENVdoesnt work here..:)