Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend and Backend bigger changes #28

Merged
merged 9 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
# Copy Backend Files to VM using scp
- name: Copy Backend to VM
run: |
scp -v -o StrictHostKeyChecking=no -r ./backend/* ${{ secrets.VM_USER }}@${{ secrets.VM_IP }}:~/smetovi/backend
scp -o StrictHostKeyChecking=no -r ./backend/* ${{ secrets.VM_USER }}@${{ secrets.VM_IP }}:~/smetovi/backend

# Restart Node.js Backend on VM
- name: Restart Backend on VM
Expand Down
16 changes: 11 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
"request": "launch",
"name": "Launch Program",
"env": {
"DB_HOST": "localhost",
"DB_USER": "root",
"DB_PASSWORD": "",
"DB_NAME": "smetovi",
"PORT": "4001"
"DATABASE_URL":"postgresql://neondb_owner:nekYVhH8Tzo6@ep-holy-moon-a5i4sdfw-pooler.us-east-2.aws.neon.tech/smetovi?sslmode=require",
"JWT_SECRET":"mysueprsecret",
"JWT_REFRESH_SECRET":"myrefreshsupersecret",
"PORT":"4000",
"SMTP_HOST":"mail.smetovi.ba",
"SMTP_PORT":"465",
"SMTP_USER":"support@smetovi.ba",
"SMTP_PASS":"P8es3G[W=7m&",
"DEFAULT_SENDER_EMAIL":"support@smetovi.ba",
"DEFAULT_RECEIVER_EMAIL":"support@smetovi.ba",
"DEFAULT_RECEIVER_NAME":"Smetovi"
},
"skipFiles": [
"<node_internals>/**"
Expand Down
113 changes: 113 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Operating System Files
.DS_Store
Thumbs.db

# Editor and IDE Files
.vscode/
.idea/
*.swp
*.swo
*~

# Build and Dependency Directories
node_modules/
build/
dist/
target/
out/
.next/

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Environment Variables
.env
.env.local
.env.*.local

# Compiled Files
*.com
*.class
*.dll
*.exe
*.o
*.so

# Package Files
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Database Files
*.sqlite
*.db

# Temporary Files
*.tmp
*.temp
*.bak

# Python
__pycache__/
*.py[cod]
*.pyo
*.egg-info/
.Python
venv/
env/

# Java
*.class
*.jar
*.war
*.ear
*.logs
.gradle/

# JavaScript / Node.js
npm-debug.log
yarn-error.log
.pnp/
.pnp.js

# Ruby
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Miscellaneous
*.bak
*.swp
*.swo
*.swn
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Ignore Angular/Webpack cache and build files
.cache/
*.cache
*.log
node_modules/
dist/
build/
webpack*
95 changes: 0 additions & 95 deletions backend/api_test/locations_enpoints.http

This file was deleted.

30 changes: 18 additions & 12 deletions backend/config/db.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
const mysql = require("mysql2");
require("dotenv").config();

const pool = mysql.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0,
const { Sequelize } = require('sequelize');
const dotenv = require('dotenv');

dotenv.config();

const sequelize = new Sequelize(process.env.DATABASE_URL, {
dialect: 'postgres',
logging: false,
});

module.exports = pool.promise();
const connectDB = async () => {
try {
await sequelize.authenticate();
console.log('Connection has been established successfully.');
} catch (error) {
console.error('Unable to connect to the database:', error);
}
};

module.exports = { sequelize, connectDB };
107 changes: 0 additions & 107 deletions backend/config/dbInit.js

This file was deleted.

Loading
Loading