Git Product home page Git Product logo

rps's Introduction

Rock Paper Scissors

"Life is more fun if you play games." โ€” Roald Dahl

Requirements

Usage

Initial setup

Install and configure the application:

# Clone the repository.
git clone https://github.com/MediaComem/rps.git

# Install dependencies.
cd rps
npm ci

# Create a PostgreSQL user named "rps".
sudo -u postgres createuser --pwprompt rps

# Create an empty PostgreSQL database named "rps" and owned by the "rps" user.
sudo -u postgres createdb --owner rps rps

# Create the "uuid-ossp" PostgreSQL extension in the "rps" database.
sudo -u postgres psql -d rps -c 'CREATE EXTENSION "uuid-ossp"'

# Create a .env file and edit it to adapt the PostgreSQL connection URL
# according to the user and database you just created.
cp .env.sample .env

If you are in a memory-constrained environment such as a small cloud server, install the pre-compiled version of the application which will be downloaded from GitHub:

npm run build:precompiled

Otherwise, you can perform a full build, which requires copious amounts of CPU and RAM:

npm run build

Once the build is done, migrate the database to the latest version:

npm run migrate

Updating

To take all changes into account after updating the code to the latest version, execute the following commands in the application's directory:

# Update dependencies (install new ones and upgrade existing ones).
npm install

# Install the pre-compiled build or build the application again (one or the
# other depending on your server's capabilities).
npm run build:precompiled
npm run build

# Migrate the database to the latest version.
npm run migrate

Local development

WARNING: do NOT do this in memory-constrained environments such as a small cloud server. This is intended for development on your local machine.

# Run the application in development mode with live code reload.
npm run dev

Production deployment

# Run the application in production mode.
npm start

Configuration

The following environment variables can be set to customize the application's behavior:

Variable Default value Description
RPS_DATABASE_DEBUG false When true, database queries are logged.
RPS_DATABASE_URL or DATABASE_URL postgresql://rps@localhost/rps PostgreSQL connection URL.
RPS_PORT or PORT 3000 The port on which the application will listen to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.