Skip to content
Discussion options

You must be logged in to vote

You can fix that when you use Express like this.

//EXPRESS
const app = express();
if (process.env.NODE_ENV == "production") app.use(enforce.HTTPS({ trustProtoHeader: true }));
app.use(compression());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cors({
origin: '',
methods: ['GET', 'POST', 'DELETE', 'UPDATE', 'PUT', 'PATCH'],
credentials: true
}));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, './FE/build')));
app.get("
", (req, res) => {
res.sendFile(path.join(__dirname, './FE/build', 'index.html'));
});

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by encourage317125
Comment options

You must be logged in to vote
1 reply
@sbsoso0411
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants