Skip to content

This web app determines whether or not a number is prime.

Notifications You must be signed in to change notification settings

farnswj1/PrimalityTester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Primality Tester

This web app determines whether or not a number is prime.

Setup

The project uses the following:

  • TypeScript
  • Node.js
  • Express
  • NPM
  • React
  • Material-UI
  • Vite
  • Redis
  • Nginx
  • Certbot
  • Travis CI
  • Docker
  • Docker Compose

For additional information on project specifications, see backend/package.json for the backend server and frontend/package.json for the frontend respectively.

Backend

In the backend directory, create a .env file that contains the following environment variables:

ALLOWED_ORIGINS=http://localhost http://127.0.0.1
REDIS_URL=redis://redis:6379/0
PORT=8000

Frontend

The frontend directory must also have a .env file with the following variables:

VITE_API_URL=http://127.0.0.1

The URL should be the endpoint of the backend server.

Building

The project uses Docker. Ensure Docker and Docker Compose are installed before continuing.

To build, run docker compose build

Running

To run the web app, run docker compose up -d, then go to http://localhost using your web browser.

Setting Up HTTPS With Certbot

There are configurations already set up via cli.ini in the certbot directory. To receive an SSL certificate using those configurations, run:

docker compose run --no-deps --rm certbot certonly -d [enter domain here]

Fill out the prompt, then configure Nginx to use the SSL certificate and domain.

To renew the SSL certificate and use the newest certificate, run:

docker compose run --no-deps --rm certbot renew && docker exec nginx nginx -s reload

NOTE: Ensure port 443 is exposed in docker-compose.yml for HTTPS.

About

This web app determines whether or not a number is prime.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published