diff --git a/README b/README index 3a3a5a0..2b9e566 100644 --- a/README +++ b/README @@ -14,3 +14,17 @@ 10. sever side request forgery 11. broken authentication and session management 12. clickjacking + +## backend + +backend-for-frontend server + +!remember to set the environment variables +!include this in the setup instructions +!should we use a .env file and let the user set the variables? + +PGHOST=localhost +PGPORT=5432 +PGDATABASE=asdfdb +PGUSER=asdfuser +PGPASSWORD=asdfpassword diff --git a/client/bun.lockb b/client/bun.lockb index a8a8380..34556df 100755 Binary files a/client/bun.lockb and b/client/bun.lockb differ diff --git a/client/package.json b/client/package.json index ae8afce..4a37b88 100644 --- a/client/package.json +++ b/client/package.json @@ -18,8 +18,11 @@ "@mui/lab": "^6.0.0-beta.14", "@mui/material": "^6.1.6", "@tauri-apps/api": "^2.1.0", + "@types/pg": "^8.11.10", + "dotenv": "^16.4.5", "jotai": "^2.10.1", "next": "^15.0.3", + "pg": "^8.13.1", "react": "^18.3.1", "react-dom": "^18.3.1" }, diff --git a/client/src/components/Generic/Layout.tsx b/client/src/components/Generic/Layout.tsx index a2b75d3..9cad2af 100644 --- a/client/src/components/Generic/Layout.tsx +++ b/client/src/components/Generic/Layout.tsx @@ -3,7 +3,6 @@ import { Button, Container, Grid2, - Input, Switch, TextField, Typography, @@ -12,7 +11,6 @@ import { import { HeaderBar } from "../HeaderBar/HeaderBar"; import { AttackItem } from "../Home/AttackItem"; -import Link from "next/link"; export const Layout = () => { // contexts @@ -78,7 +76,11 @@ export const Layout = () => { debounce when typing update textfield color based on the response */} - + } + openState={openState} + setMaximisedState={setMaximisedState} + title="Testing" + /> + ); +}; diff --git a/client/src/lib/postgresql.ts b/client/src/lib/postgresql.ts new file mode 100644 index 0000000..783b8a6 --- /dev/null +++ b/client/src/lib/postgresql.ts @@ -0,0 +1,17 @@ +import { Client } from "pg"; +import "dotenv/config"; + +console.log("PGHOST:", process.env.PGHOST); + +export const pgClient = new Client({ + host: "localhost", + port: 5432, + user: "asdfuser", + password: "asdfpassword", + database: "asdfdb", +}); + +pgClient + .connect() + .then(() => console.log("Connected to PostgreSQL")) + .catch((err) => console.error("Error connecting to PostgreSQL", err)); diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..35eef03 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,14 @@ +services: + postgres: + image: postgres:latest + container_name: postgres_db + environment: + POSTGRES_USER: asdfuser + POSTGRES_PASSWORD: asdfpassword + POSTGRES_DB: asdfdb + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data +volumes: + postgres_data: