-
Notifications
You must be signed in to change notification settings - Fork 3
Local Frontend Testing Guide
Below is a guide for running the ConU CoursePlanner frontend on your local machine for faster testing than having to do a full build + deploy each time you make a change. This is not the only way to get this working but it is the way that I have got it working for myself and it's very simple so I recommend this method. - David
Install the following programs:
- nodejs - to build the frontend
- IntelliJ or any static file server - to serve the static frontend files (html, css, js) locally
- nginx - to redirect (a.k.a. proxy) all backend requests to our remote server
maven does not need to be installed for this to work
-
Start IntelliJ, go to File tab -> Settings -> Build, Execution, Deployment --> Debugger --> Built-in server and make note of the listed port number (I believe the default is 63342). Also, check the box that reads "Allow unsigned requests" - this was sometimes needed for this to work.
-
Navigate to the
conf/folder in the location where you installed nginx (on Ubuntu mine was located at/usr/local/nginx/conf/, though I think the default installation dir is/etc/nginx). Open up the file namednginx.confand replace the contents of the file with my configuration sample file. -
If needed, replace the port number (127.0.0.1:63342) on line 20 with the one you found in step 1.
-
If needed, replace the url of the backend to use your own (the sample I added uses
courseplannerd). -
Start nginx by navigating to the location where you installed nginx and run the program:
On Windows (in git bash)
# hit Ctrl+C to stop it ./nginx.exeOn Linux
# start nginx sudo ./nginx # stop nginx sudo ./nginx -s stop
- Before anything, install node dependencies if needed:
npm install
-
Navigate to the root folder of the project and run the frontend build or watch command(s):
Build frontend
npm run build-devOR
Watch frontend
npm run watch -
Type
localhostin your browser window or click the link: http://localhost/ -
Make changes to code (I recommend changing a string value in
src/main/webapp/babel-src/util.jsto check that it's working). -
If you ran the watch command, wait a few seconds for the build to finish then refresh the page. Else, the frontend will not be built automatically when you edit the source files so you must repeat step 1 then refresh the page.
Don't forget that for this specific setup, you will need both IntelliJ and nginx to be running otherwise http://localhost/ won't work
- General Project Docs
- Deployment Guide
- Local Frontend Testing Guide
- REST API Spec
- Dev Tips/Miscellaneous