This's the repo of XOJ frontend.
You can access https://xoj.codes/ to visit deployed website.
Process to develop in Development env:
- Install Node.js, and add it to your environment variables.
- Select a plain folder, open the terminal located in this folder, run
git clone https://[email protected]/XOJ-Team/CPT202 Team B-3/_git/XOJ_F
in your terminal. - cd to the folder XOJ_F.
- For requesting to backend API, change 'urlpool' to your backend root url in file: src/utils/request.js
- run
npm install yarn
and runyarn
to download dependencies. - run project: run
npm start
to run local develop server, then open the browser and visit localhost:3000.
Process to deploy Production env:
- Need to finish step 5 showed before.
- open the terminal and cd to the folder XOJ_F.
- run
npm run build
, then a folder 'build' is created. - Move this ‘build’ folder to cloud server.
- the simplest way to deploy is install Node in server, copy runserver.js in project with ‘build’ folder to server, then run
node runserver.js
, or you can use nginx: copy folder 'build' to path like '/usr/local/var/www', install nginx, then add this text in nginx.conf then runnginx -s reload
.
location {
alias /usr/local/var/www/build;
index index.html;
try_files $uri /index.html;
}
- then you can visit http://YourIP/.
craco.config.js: config of DIY Theme @Antd-Doc
Store public static resources such as index.html, favicon and logo.
App.js: entrance file index.js: entrance file
Context variable sharing component.
Mainrouters.js config main routes.
Contains components and layouts.
Encapsulate requests to API.
Main pages in application.
Store all tools like timeutils and axios.
Store international language packages.
react-router-dom: v6
Use stateless components declared functionally whenever possible
Need to add your ssh public key to repository.
Check your remote target url.
kex_exchange_identification: Connection closed by remote host
do not using network proxy.
url params:
let location = useLocation()
let params = qs.parse(location.search.slice(1))
if('id' in params)//Judge whether there is a param named 'id'
context params:
const farpropsAuth=useContext(Auth)
if(farpropsAuth['pAuthority']!=null)//Judge whether Authority===null
component parmas:
if(props.size===undefined) //Judge whether there is a param named 'size'
if(props.size===null) //Judge whether props.size===null
----CPT202 Frontend Team