ContriHUB / PlayTopia

0 stars 11 forks source link

Made Routes, Controllers, middlewares and resolved errors for opening chatbot and game in same window #8

Closed sharmavasant closed 1 year ago

sharmavasant commented 1 year ago

Description

Made routes, controllers, middlewares and resolved some errors to open chatbot and game in same window when chatbot or game buttons are clicked without opening them in another window.

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Made controllers for rendering index pages of chatbot and 2 games. Made middlewares for authenticating and finally routes. Adjusted the ports for hosting them in same window. Added .env file for environment variables. Changed react-scripts to react-scripts --openssl-legacy-provider in package.json of frontend. After all this as per the issue if we click on chatbot button or any game button then it will open in same window.

Related Issue

Fixes # (issue)

Type of change

Motivation and Context

If this issue not solved then it will lead to many windows for the same website.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

After adding controllers, middlewares and routes, when buttons were clicked they opened chatbot window or games window in same window as previous. Instructions: cd backend -> npm i -> npm start cd frontend-> npm i -> npm start cd Games -> cd 2048-animated -> npm i -> npm start cd Games -> cd memory-game -> npm i -> npm start

Screenshots (if appropriate):

Checklist:

Test Configuration:

sharmavasant commented 1 year ago

@silkie261001 did my contribution solved the issue?

silkie261001 commented 1 year ago

no, have u tried on you pc. If its working send me some screenshots.

sharmavasant commented 1 year ago

no, have u tried on you pc. If its working send me some screenshots. @silkie261001 All contents opening in same window tab. Screenshot (3) Screenshot (4) Screenshot (5) Screenshot (6)

silkie261001 commented 1 year ago

You are running all the games and chatbot in different ports. Try connecting all the different ports by making routes and build the connection

On Tue, Oct 10, 2023, 12:12 PM VASANT KUMAR SHARMA @.***> wrote:

no, have u tried on you pc. If its working send me some screenshots.

[image: Screenshot (3)] https://user-images.githubusercontent.com/97390538/273801085-2ab0999a-f0fb-46de-a7cb-98f49490776f.png [image: Screenshot (4)] https://user-images.githubusercontent.com/97390538/273801097-a454fe1c-533e-4587-b6a1-24b49a4a20fd.png [image: Screenshot (5)] https://user-images.githubusercontent.com/97390538/273801104-12f06d83-a11b-40bb-b3d4-c19b50a9b94b.png [image: Screenshot (6)] https://user-images.githubusercontent.com/97390538/273801108-75234a56-0626-4cc1-98d9-048e5c665938.png

— Reply to this email directly, view it on GitHub https://github.com/ContriHUB/PlayTopia/pull/8#issuecomment-1754504231, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASRKYIZRI4PSJBJRBOHXCJDX6TU6RAVCNFSM6AAAAAA5YDUGN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJUGUYDIMRTGE . You are receiving this because you were mentioned.Message ID: @.***>

sharmavasant commented 1 year ago

means all chatbot and game should open in 3000 port? @silkie261001

silkie261001 commented 1 year ago

Yes

On Wed, Oct 11, 2023, 12:27 AM VASANT KUMAR SHARMA @.***> wrote:

means all chatbot and game should open in 3000 port? @silkie261001 https://github.com/silkie261001

— Reply to this email directly, view it on GitHub https://github.com/ContriHUB/PlayTopia/pull/8#issuecomment-1756055079, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASRKYIYBHVO5FSCQORRXILDX6WLAVAVCNFSM6AAAAAA5YDUGN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJWGA2TKMBXHE . You are receiving this because you were mentioned.Message ID: @.***>

sharmavasant commented 1 year ago

I'm trying to connect all ports to 5000 port

const { createProxyMiddleware } = require("http-proxy-middleware");
//Proxy configuration for React App 1 (running on port 3456)
const reactApp1Proxy = createProxyMiddleware("/app1", {
  target: "http://127.0.0.1:3456", // React App 1's development server
  changeOrigin: true,
});
//http://localhost:3456/
// Proxy configuration for React App 2 (running on port 3457)
const reactApp2Proxy = createProxyMiddleware("/app2", {
  target: "http://127.0.0.1:3457", // React App 2's development server
  changeOrigin: true,
});

const reactApp3Proxy = createProxyMiddleware("/app3", {
  target: "http://127.0.0.1:3000", // React App 2's development server 
  changeOrigin: true,
});

// Use proxy middleware for both apps
app.use("/app1", reactApp1Proxy);
app.use("/app2", reactApp2Proxy);
app.use("/app3", reactApp3Proxy);

But this is giving error. Screenshot (7) @silkie261001

mangalgithub commented 1 year ago

Hey @silkie261001 can you elaborate about this issue and what you want as the result

silkie261001 commented 1 year ago

Like in the current website all the pages are running on different local ports, but now you have to run all of them inside a single port.

On Fri, Oct 13, 2023, 11:14 PM Mangal Gupta @.***> wrote:

Hey @silkie261001 https://github.com/silkie261001 can you elaborate about this issue and what you want as the result

— Reply to this email directly, view it on GitHub https://github.com/ContriHUB/PlayTopia/pull/8#issuecomment-1761932532, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASRKYI32JDLOYFGJSLYUI4LX7F4YLANCNFSM6AAAAAA5YDUGNY . You are receiving this because you were mentioned.Message ID: @.***>