ssung1 / ubipong-ui-ng

This is an application to keep scores in ping pong tournaments.
0 stars 0 forks source link

Ubipong Tournament Manager

This project is aimed at managing an on-site table tennis tournament. Its goals are

Unit Test

npm test

Run Locally

Set these environment properties within apps/ubipong-ui/src/environments/environment.ts:

npm start

How to Run in WSL

If we want to run the application in WSL while accessing it from Windows, we need to listen to the host name of the WSL.

Find the IP address of WSL using

ip addr show eth0

Then run

npx ng serve --host 0.0.0.0

Now we can get to it from our browser in Windows using the IP address.

Reminder: if the API is also running in WSL, then we need to set tournamentServerUrl to the IP address.

Test (E2E)

Before testing, make sure the backend services are running.

These environment variables Set environment variable CYPRESS_CHALLONGE_API_KEY (note the CYPRESS_ prefix).

Check settings in apps/ubipong-ui-e2e/src/config/environment.ts.

Run

npx nx e2e ubipong-ui-e2e --watch

Deploy

Once the commits are merged into master branch, tag the version with

git tag v{yyyy-MM-dd}

Production URL is:

https://www.eatsleeppong.com/ubipong

Edit environment.prod.ts to set authorization server and client ID.

Rebuild the application with the correct baseHref:

npx nx build --prod --base-href /ubipong/

or routing will fail.

Note the baseHref is /ubipong/, which is the path between the host name and the index.html of the application. It must have an ending slash (if using hash navigation?).

Then copy the contents in dist/apps/ubipong-ui to a static HTTP server (a little clunky, but this avoids having to use npm express for now). And because we are deploying to a plain old web server, we need to use hash navigation.