D
D
DeniSidorenko2020-10-21 09:25:37
Node.js
DeniSidorenko, 2020-10-21 09:25:37

How to render react page in mern?

Good afternoon, I'm doing backing on Node, front on react. Previously, when I didn’t use react, I simply passed the hbs page to res.render, but how now to pass the index.html page to render, which is in the frontend / public folder?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor Zhivagin, 2020-10-21
@DeniSidorenko

There are two options:
1 -- Google how SSR is done to render a page on the server and send a ready-made, fully built page to
res.send 2 -- Just use res.sendFile('FILENAME') and give an empty page with scripts ( just your index.html), then react will build the application already on the client. Dock res.sendFile -here

P
Pavel Didenko, 2020-10-21
@Dasslier

Must use SSR

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question