Skip to content

Quickstart

Kevin Lu edited this page Nov 21, 2024 · 1 revision

To get pzoj up and running, do the following:

  1. In the client/ folder, install all necessary dependencies then host the front-end with npm start.
  2. In the web-backend/ folder, install all necessary dependencies then host the back-end with node ..
  3. In the judging-backend/ folder, compile the judge (CMake will do it for you, just create a build folder then run cmake .. and make)

This will host the front-end on port 3000, back-end on 3001, and websocket server on 3002. Note that the website will not work in this state: it expects everything to be on one port. As such, you can route them all to port 80 using the following nginx script:

server {
  listen 80;
  listen [::]:80;
  
  location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_buffers 8 16k;
    proxy_buffer_size 16k;
  }

  location /api {
    proxy_pass http://localhost:3001;
    proxy_http_version 1.1;
    proxy_buffers 8 16k;
    proxy_buffer_size 16k;
  }

  location /ws {
    proxy_pass http://localhost:3002;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_buffers 8 16k;
    proxy_buffer_size 16k;
  }
}

If you wish to add more functionality to the web back-end, make sure that all routes begin with /api/ since the nginx config routes any /api calls to the web back-end.

Clone this wiki locally