Surge is great.
Harpreet Mann
3

After reading the create react app docs more closely I realized I don’t need a proxy server in production. However, I still keep getting that same error where it cannot find the end point. This is what my server file looks like:
var app = express()
app.use(cors())
app.use(bodyParser())

app.use(session({
 secret: ‘secret’,
 resave: false,
 saveUninitialized: true
}));
app.use(“/”, authRouter);
app.use(‘/api’,router)

app.use(express.static(‘../../build’));

app.get(‘/*’, function (req, res) {
 res.sendFile(path.join(__dirname, ‘../../build’, ‘index.html’));
 });
app.listen(3001, function(err) {
 if (err) console.log(err);
 console.log(‘Listening at port 3001’);
});

This all works fine on localhost: 3001

Like what you read? Give Harpreet Mann a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.