PR-994018: Adding support to Prefix url.

This commit is contained in:
Alejandro Lembke Barrientos 2023-10-17 18:31:48 +00:00
parent bb24d91ae7
commit 6225b8bd7a
3 changed files with 6 additions and 3 deletions

View File

@ -3,4 +3,6 @@ ENV= #Default production
#App Port #App Port
PORT= #Default 80 PORT= #Default 80
#Host #Host
HOST= #Default localhost HOST= #Default localhost
#Prefix URL
PREFIX_URL= #Default ''

View File

@ -1,6 +1,6 @@
{ {
"name": "test-list-app", "name": "test-list-app",
"version": "1.0.2", "version": "1.0.3",
"description": "Starter Kit of server side render of react with backend in go", "description": "Starter Kit of server side render of react with backend in go",
"scripts": { "scripts": {
"start": "cd build/server && ./react-server", "start": "cd build/server && ./react-server",

View File

@ -3,9 +3,10 @@ import PrincipalRoutes from './PrincipalRoutes';
import { config } from '../../../config'; import { config } from '../../../config';
const App = () => { const App = () => {
const { PREFIX_URL } = config;
if(config.ENV === 'development') { if(config.ENV === 'development') {
useEffect(() => { useEffect(() => {
const ws = new WebSocket(`wss://${config.HOST}/ws`); const ws = new WebSocket(`wss://${config.HOST}${PREFIX_URL}/ws`);
ws.onmessage = (event) => { ws.onmessage = (event) => {
if (event.data === 'reload') { if (event.data === 'reload') {
window.location.reload(); window.location.reload();