-2
We created our first project in React, local everything works normal..
When we host on the web ... the system enters the address for example https://www.dominio.com/painel_teste
At that moment appears the login screen (is placed user and password ) and enters the system screen (ok) address https://www.dominio.com/painel_teste/termometro ....
When trying to update the page ... F5 ... the address keeps the same but the message appears on the screen
cannot GET //thermometer ...
as if it were some route problem ....
We have tried several alternatives and all without success....
Some considerations
1 ) I managed the project build
2 ) Move the build folder up to the test panel folder (on the server)
3 ) I created a configuration file "painel_teste.js" with the following configuration
var http = require('http');
const express = require('express');
const app = express();
const baseDir = `${__dirname}/build/`
app.use(express.static(`${baseDir}`))
app.get('/painel_teste', (req, res) => res.sendfile('index.html' , { root : baseDir } ))
const port = 21164;
app.listen(port)
4 ) Archive of Routes
const Routes = () => (
<Router>
<Switch>
<Route exact path="/painel_teste" component={Login} />
<PrivateRoute exact path="/painel_teste/termometro" component={TermometroRRC} />
<Route exact path="/logout" component={Logout} />
</Switch>
</Router>
);
I await suggestions ....