From e5023f51e832d97c3bd7784a5a29981eccdce887 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Tue, 29 Oct 2024 15:08:00 +0000 Subject: [PATCH 01/11] Add health endpoint --- public/health.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 public/health.js diff --git a/public/health.js b/public/health.js new file mode 100644 index 00000000..61a4202b --- /dev/null +++ b/public/health.js @@ -0,0 +1,9 @@ +import http from "http" + +http + .createServer((req, res) => + res + .writeHead(200, { "Content-Type": "application/json" }) + .end(JSON.stringify(process.env.NODE_ENV)), + ) + .listen() From 50e686875b57ca6e4cc0e37b716134824fc7f050 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Tue, 29 Oct 2024 15:20:11 +0000 Subject: [PATCH 02/11] Try adding health route --- public/health.js => src/components/Health.js | 0 src/components/RehydrationProvider.js | 2 ++ src/utils/routingConstants.js | 1 + 3 files changed, 3 insertions(+) rename public/health.js => src/components/Health.js (100%) diff --git a/public/health.js b/src/components/Health.js similarity index 100% rename from public/health.js rename to src/components/Health.js diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index b549b534..1671f1fd 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -37,6 +37,7 @@ import PageFile from './Navigation/Pages/PageFile' import PageHarvest from './Navigation/Pages/PageHarvest' import GetInvolved from './GetInvolved' import Charter from './Charter' +import Health from './Health' const store = configureStore() @@ -99,6 +100,7 @@ export default class RehydrationDelayedProvider extends Component { (window.location = 'https://discord.gg/wEzHJku')} /> + diff --git a/src/utils/routingConstants.js b/src/utils/routingConstants.js index 49835bee..92fa3cc4 100644 --- a/src/utils/routingConstants.js +++ b/src/utils/routingConstants.js @@ -13,4 +13,5 @@ export const ROUTE_STATUS = '/status' export const ROUTE_GETINVOLED = '/get-involved' export const ROUTE_CHARTER = '/charter' export const ROUTE_FILE = '/file' +export const ROUTE_HEALTH = '/health' export const ROUTE_ROOT = '/' From 31ec66389b71d94c42d3cb8820bbacb213135d25 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 10:37:50 +0000 Subject: [PATCH 03/11] Remove health --- src/components/Health.js | 9 --------- src/components/RehydrationProvider.js | 2 -- src/index.js | 2 +- src/utils/routingConstants.js | 2 +- 4 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 src/components/Health.js diff --git a/src/components/Health.js b/src/components/Health.js deleted file mode 100644 index 61a4202b..00000000 --- a/src/components/Health.js +++ /dev/null @@ -1,9 +0,0 @@ -import http from "http" - -http - .createServer((req, res) => - res - .writeHead(200, { "Content-Type": "application/json" }) - .end(JSON.stringify(process.env.NODE_ENV)), - ) - .listen() diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index 1671f1fd..b549b534 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -37,7 +37,6 @@ import PageFile from './Navigation/Pages/PageFile' import PageHarvest from './Navigation/Pages/PageHarvest' import GetInvolved from './GetInvolved' import Charter from './Charter' -import Health from './Health' const store = configureStore() @@ -100,7 +99,6 @@ export default class RehydrationDelayedProvider extends Component { (window.location = 'https://discord.gg/wEzHJku')} /> - diff --git a/src/index.js b/src/index.js index df2edd7e..9a06bf29 100644 --- a/src/index.js +++ b/src/index.js @@ -19,4 +19,4 @@ if (!Array.prototype.includes) 'You need a browser that supports modern JavaScript features to view this site. Please switch to another browser.' ) ReactDOM.render(< RehydrationProvider />, document.getElementById('root')) -unregister() \ No newline at end of file +unregister() diff --git a/src/utils/routingConstants.js b/src/utils/routingConstants.js index 92fa3cc4..61aad099 100644 --- a/src/utils/routingConstants.js +++ b/src/utils/routingConstants.js @@ -13,5 +13,5 @@ export const ROUTE_STATUS = '/status' export const ROUTE_GETINVOLED = '/get-involved' export const ROUTE_CHARTER = '/charter' export const ROUTE_FILE = '/file' -export const ROUTE_HEALTH = '/health' +// export const ROUTE_HEALTH = '/health' export const ROUTE_ROOT = '/' From 528828d404ed7f17cb9bbb3f81ceb3dbcc590ddc Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 10:44:45 +0000 Subject: [PATCH 04/11] Health as a component --- src/components/HealthCheck.js | 11 +++++++++++ src/components/RehydrationProvider.js | 5 ++++- src/utils/routingConstants.js | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/components/HealthCheck.js diff --git a/src/components/HealthCheck.js b/src/components/HealthCheck.js new file mode 100644 index 00000000..a97790a5 --- /dev/null +++ b/src/components/HealthCheck.js @@ -0,0 +1,11 @@ +import React from 'react'; + +const HealthCheck = () => { + return ( +
+
{JSON.stringify({foo: "bar"})}
+
+ ); +}; + +export default HealthCheck; diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index b549b534..e862349e 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -17,7 +17,8 @@ import { ROUTE_STATUS, ROUTE_GETINVOLED, ROUTE_CHARTER, - ROUTE_FILE + ROUTE_FILE, + ROUTE_HEALTH } from '../utils/routingConstants' import history from '../config/history' import { configureStore } from '../configureStore' @@ -37,6 +38,7 @@ import PageFile from './Navigation/Pages/PageFile' import PageHarvest from './Navigation/Pages/PageHarvest' import GetInvolved from './GetInvolved' import Charter from './Charter' +import HealthCheck from './HealthCheck' const store = configureStore() @@ -98,6 +100,7 @@ export default class RehydrationDelayedProvider extends Component { (window.location = 'https://discord.gg/wEzHJku')} /> + diff --git a/src/utils/routingConstants.js b/src/utils/routingConstants.js index 61aad099..b8bdf3fb 100644 --- a/src/utils/routingConstants.js +++ b/src/utils/routingConstants.js @@ -13,5 +13,5 @@ export const ROUTE_STATUS = '/status' export const ROUTE_GETINVOLED = '/get-involved' export const ROUTE_CHARTER = '/charter' export const ROUTE_FILE = '/file' -// export const ROUTE_HEALTH = '/health' +export const ROUTE_HEATH = '/root' export const ROUTE_ROOT = '/' From 1f80b2f447e175c047b84ccee5710bab9e7b0653 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 10:47:26 +0000 Subject: [PATCH 05/11] Typo --- src/utils/routingConstants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/routingConstants.js b/src/utils/routingConstants.js index b8bdf3fb..1fc673be 100644 --- a/src/utils/routingConstants.js +++ b/src/utils/routingConstants.js @@ -13,5 +13,5 @@ export const ROUTE_STATUS = '/status' export const ROUTE_GETINVOLED = '/get-involved' export const ROUTE_CHARTER = '/charter' export const ROUTE_FILE = '/file' -export const ROUTE_HEATH = '/root' +export const ROUTE_HEALTH = '/root' export const ROUTE_ROOT = '/' From e8089770a1240c107f9b5dcc2211eb272b113906 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 10:50:56 +0000 Subject: [PATCH 06/11] Correct route --- src/utils/routingConstants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/routingConstants.js b/src/utils/routingConstants.js index 1fc673be..92fa3cc4 100644 --- a/src/utils/routingConstants.js +++ b/src/utils/routingConstants.js @@ -13,5 +13,5 @@ export const ROUTE_STATUS = '/status' export const ROUTE_GETINVOLED = '/get-involved' export const ROUTE_CHARTER = '/charter' export const ROUTE_FILE = '/file' -export const ROUTE_HEALTH = '/root' +export const ROUTE_HEALTH = '/health' export const ROUTE_ROOT = '/' From c0ae50d0b502ecff8db9a64bba0a29f051c50ad4 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 10:55:52 +0000 Subject: [PATCH 07/11] Remove --- src/components/HealthCheck.js | 11 ----------- src/components/RehydrationProvider.js | 2 -- src/utils/routingConstants.js | 1 - 3 files changed, 14 deletions(-) delete mode 100644 src/components/HealthCheck.js diff --git a/src/components/HealthCheck.js b/src/components/HealthCheck.js deleted file mode 100644 index a97790a5..00000000 --- a/src/components/HealthCheck.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; - -const HealthCheck = () => { - return ( -
-
{JSON.stringify({foo: "bar"})}
-
- ); -}; - -export default HealthCheck; diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index e862349e..70cc2dbc 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -18,7 +18,6 @@ import { ROUTE_GETINVOLED, ROUTE_CHARTER, ROUTE_FILE, - ROUTE_HEALTH } from '../utils/routingConstants' import history from '../config/history' import { configureStore } from '../configureStore' @@ -100,7 +99,6 @@ export default class RehydrationDelayedProvider extends Component { (window.location = 'https://discord.gg/wEzHJku')} /> - diff --git a/src/utils/routingConstants.js b/src/utils/routingConstants.js index 92fa3cc4..49835bee 100644 --- a/src/utils/routingConstants.js +++ b/src/utils/routingConstants.js @@ -13,5 +13,4 @@ export const ROUTE_STATUS = '/status' export const ROUTE_GETINVOLED = '/get-involved' export const ROUTE_CHARTER = '/charter' export const ROUTE_FILE = '/file' -export const ROUTE_HEALTH = '/health' export const ROUTE_ROOT = '/' From 42e066c4e69600b467af168fdd185f60f2125b49 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 11:11:16 +0000 Subject: [PATCH 08/11] Revert "Remove" This reverts commit c0ae50d0b502ecff8db9a64bba0a29f051c50ad4. --- src/components/HealthCheck.js | 11 +++++++++++ src/components/RehydrationProvider.js | 2 ++ src/utils/routingConstants.js | 1 + 3 files changed, 14 insertions(+) create mode 100644 src/components/HealthCheck.js diff --git a/src/components/HealthCheck.js b/src/components/HealthCheck.js new file mode 100644 index 00000000..a97790a5 --- /dev/null +++ b/src/components/HealthCheck.js @@ -0,0 +1,11 @@ +import React from 'react'; + +const HealthCheck = () => { + return ( +
+
{JSON.stringify({foo: "bar"})}
+
+ ); +}; + +export default HealthCheck; diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index 70cc2dbc..e862349e 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -18,6 +18,7 @@ import { ROUTE_GETINVOLED, ROUTE_CHARTER, ROUTE_FILE, + ROUTE_HEALTH } from '../utils/routingConstants' import history from '../config/history' import { configureStore } from '../configureStore' @@ -99,6 +100,7 @@ export default class RehydrationDelayedProvider extends Component { (window.location = 'https://discord.gg/wEzHJku')} /> + diff --git a/src/utils/routingConstants.js b/src/utils/routingConstants.js index 49835bee..92fa3cc4 100644 --- a/src/utils/routingConstants.js +++ b/src/utils/routingConstants.js @@ -13,4 +13,5 @@ export const ROUTE_STATUS = '/status' export const ROUTE_GETINVOLED = '/get-involved' export const ROUTE_CHARTER = '/charter' export const ROUTE_FILE = '/file' +export const ROUTE_HEALTH = '/health' export const ROUTE_ROOT = '/' From a2a96e53f9095243838e3cafcb8bc43c9e330e4b Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 11:29:43 +0000 Subject: [PATCH 09/11] Health without page --- src/components/RehydrationProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index e862349e..06693b68 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -85,6 +85,7 @@ export default class RehydrationDelayedProvider extends Component { return ( + @@ -100,7 +101,6 @@ export default class RehydrationDelayedProvider extends Component { (window.location = 'https://discord.gg/wEzHJku')} /> - From 7bb1af02fa531d7108ca85d7dfb258c75110110e Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 11:38:12 +0000 Subject: [PATCH 10/11] Once child element --- src/components/RehydrationProvider.js | 40 ++++++++++++++------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index 06693b68..2c421738 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -85,25 +85,27 @@ export default class RehydrationDelayedProvider extends Component { return ( - - - - - (window.location = ROUTE_WORKSPACE)} /> - - - - - - - - - - (window.location = 'https://discord.gg/wEzHJku')} /> - - - - + + + + + + (window.location = ROUTE_WORKSPACE)} /> + + + + + + + + + + (window.location = 'https://discord.gg/wEzHJku')} /> + + + + + ) From 73a4df516dfab435a5ef468f9e20993ac7b01fea Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 30 Oct 2024 11:45:17 +0000 Subject: [PATCH 11/11] Wrap in nested switch so health doesn't have class --- src/components/RehydrationProvider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/RehydrationProvider.js b/src/components/RehydrationProvider.js index 2c421738..b43fad5a 100644 --- a/src/components/RehydrationProvider.js +++ b/src/components/RehydrationProvider.js @@ -85,7 +85,7 @@ export default class RehydrationDelayedProvider extends Component { return ( - + @@ -105,7 +105,7 @@ export default class RehydrationDelayedProvider extends Component { - + )