write README for setting up app in dev

This commit is contained in:
Nuwan Chathuranga 2021-09-28 19:38:47 +05:30 committed by Nuwan
parent 791f536c8b
commit 6dae6ba53c
7 changed files with 41 additions and 10 deletions

View File

@ -1,2 +0,0 @@
REACT_APP_LEGACY_BASE_URL=http://www.jamkazam.local:4000
REACT_APP_API_BASE_URL=http://www.jamkazam.local:4000/api

View File

@ -0,0 +1,4 @@
HOST=beta.jamkazam.local
PORT=4000
REACT_APP_LEGACY_BASE_URL=http://www.jamkazam.local:3000
REACT_APP_API_BASE_URL=http://www.jamkazam.local:3000/api

View File

@ -1,2 +1,4 @@
HOST=beta.jamkazam.com
PORT=4000
REACT_APP_LEGACY_BASE_URL=https://www.jamkazam.com
REACT_APP_API_BASE_URL=https://www.jamkazam.com/api

View File

@ -1,4 +1,31 @@
## Falcon, a theme by ThemeWagon team.
---
Get the figma design file here:
[https://www.figma.com/file/wX672ke9PvFbwGNiCxefAd/Falcon-Design](https://www.figma.com/file/wX672ke9PvFbwGNiCxefAd/Falcon-Design)
# JamKazam new react frontend UI/UX
## Running react app
In production this React app is supposed to run on beta.jamkazam.com subdomain which is same origin domain to the production Rails app (www.jamkazam.com). This way we utilize same session based user authentication of Rails web app for authenticating users. (It looks for remember_token session cookie in headers and if it is not availale redirect the user to Rails web app sign in page)
The DOMAIN and PORT running this app is defined in env.production file. This file also has env variables for connecting with Rails app. (When setting up in development you can copy the content of env.development.example in to env.development.local and change them according to your host setup)
HOST=beta.jamkazam.local
PORT=4000
REACT_APP_LEGACY_BASE_URL=http://www.jamkazam.local:3000
REACT_APP_API_BASE_URL=http://www.jamkazam.local:3000/api
## Subdomains setup (development)
You need 2 host records created for React and and Rails app. For example
127.0.0.1 www.jamkazam.local #for Rails app
127.0.0.1 beta.jamkazam.local #for React app
## Installing npm dependencies
cd jam-ui
npm install
## Running the app
cd jam-ui
npm run start
This will open it in a borwser window at http://beta.jamkazam.local:3000. Of course for it to work you also need Rails (web) app and websocket app (websocket-gateway) running.

View File

@ -75,7 +75,7 @@
"uuid": "^3.4.0"
},
"scripts": {
"start": "HOST=beta.jamkazam.local react-scripts start",
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"scss": "gulp",

View File

@ -8,13 +8,13 @@ function JKLoginRequest() {
<Section className="py-0">
<Row className="flex-center min-vh-100 py-6">
<Col sm={10} md={8} lg={6} xl={5} className="col-xxl-4">
<Logo />
<Logo width={250}/>
<Card>
<CardBody className="fs--1 font-weight-normal p-5">
<Row className="justify-content-center">
<h3 className="mt-3 mt-md-4 font-weight-normal fs-2">Signin to begin</h3>
<p>Please login to your jamkazam account before accessing this interface.</p>
<a className="btn btn-primary" href="https://www.jamkazam.com/signin">
<a className="btn btn-primary" href={`${process.env.REACT_APP_LEGACY_BASE_URL}/signin`}>
Signin
</a>
</Row>

View File

@ -117,7 +117,7 @@ SampleApp::Application.configure do
config.latency_data_host = "http://localhost:4001/local"
config.latency_data_host_auth_code = "c2VydmVyOnBhc3N3b3Jk"
config.spa_origin = "http://beta.jamkazam.local:3000"
config.spa_origin = "http://beta.jamkazam.local:4000"
config.session_cookie_domain = ".jamkazam.local"
end