rdeepak2002 / TokTok

Personal to-do list and reminders app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TokTok

How to Run

Navigate to the 'back' folder

cd back

Create credentials file

nano key.json

Add the following mongodb credentials

{
  "username" : "<mongodb username>",
  "password" : "<mongodb password>",
  "cluster" : "<mongodb cluster>",
  "secret" : "<some really long, randomly generated string with numbers and symbols>"
}

Install node modules

npm install

Run the server

node server.js

How to Add Nginx Reverse Proxy

Edit the default config file

sudo nano /etc/nginx/sites-enabled/default

Replace its contents with the following

server {
  listen 80 default_server;
  listen [::]:80 default_server;

  root /var/www/html;

  index index.html index.htm index.nginx-debian.html;

  server_name _;

  location / {
    proxy_pass http://localhost:5000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}

Restart nginx

sudo systemctl restart nginx

How to Autostart

Install pm2

sudo npm install -g pm2

Start server

pm2 start server.js

Get startup command

pm2 startup systemd

Copy and paste the output of the last command

sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi

Save current pm2 state (running server.js)

pm2 save

How to Update Front-End (React) Code

Navigate to the 'front' folder

cd front

Install node modules

npm install

Build the React project for production

npm run build

HTTPS Configuration

Use https://www.sslforfree.com/ to generate keys

server {
  listen       80;
  listen       443 ssl;
  server_name  localhost;

  ssl_certificate  /etc/nginx/ssl/server.crt;
  ssl_certificate_key /etc/nginx/ssl/server.key;

  location / {
    proxy_pass http://localhost:5000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}

About

Personal to-do list and reminders app.

License:GNU General Public License v3.0


Languages

Language:JavaScript 77.1%Language:CSS 12.8%Language:HTML 10.1%