Skip to content

Latest commit

 

History

History
112 lines (71 loc) · 2.58 KB

README.md

File metadata and controls

112 lines (71 loc) · 2.58 KB

Smur

github license code style: prettier

🚀 Getting Started

📋 Prerequisites

  • node >=14.5.0
  • mongodb >= v4.2
  • redis-server >= v4.0.9 (for socket.io and caching)
    • wsl (only required on windows to run redis-server)

🔧 Installing

Clone this repo

git clone <repo_url>

cd ./<project_directory>

Create and switch to directory to store keys

mkdir -p ./.keys && cd ./.keys

Generate RSA keys for JWT

On windows use git-bash or wsl

# Generate RSA256 certificate
ssh-keygen -t rsa -b 2048 -m PEM -f jwt_rsa.key

# Convert RSA256 public key to certificate
openssl rsa -in jwt_rsa.key -pubout -outform PEM -out jwt_rsa.key.pub

Go back to project root

cd ..

Install all dependencies

npm i

List of dependencies can be found in package.json

Configuration

For config, see Additional Configuration

Debugging

  • Debugging config for visual studio code is already included Press F5 to start debugging

Logging

  • By default, run-time exceptions will be logged to ./.logs/<NODE_ENV>/<YYYY>-<MM>/<YYYY>-<MM>-<DD>.json

To change logging to database see Additional Configuration

📦 FrontEnd

  • Build and place your frontend files in /public directory
  • All HTTP GET requests not matching with ^\/api* will be redirected to /public/index.html

⚙️ Running

npm start          # runs `npm run dev`
npm run dev        # runs in development mode
npm run prod       # runs in production mode
npm run prod-stop  # stops in production mode
npm run prod-monit # `pm2 monit` in production

If you're using windows, please ensure that redis-server is running inside wsl before you run any of these commands > wsl sudo service redis-server restart

Production mode uses pm2 cluster-mode for load-balancing

See scripts in package.json

🛠️ Development

Testing

npm run test

Linting

npm run lint .

ESLint plugins for vscode

code --install-extension dbaeumer.vscode-eslint