mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-07 17:38:50 +00:00
updated README
This commit is contained in:
parent
aa3f86d05b
commit
148e44a705
4 changed files with 73 additions and 29 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Hier ist deine überarbeitete Dokumentation mit **korrigierten Rechtschreibfehlern, konsistenter Formatierung** und kleineren stilistischen Verbesserungen:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 📦 Verwendete Software
|
## 📦 Verwendete Software
|
||||||
|
|
||||||
- **Backend:** Node.js
|
- **Backend:** Node.js
|
||||||
|
@ -6,75 +10,109 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Backend Nutzung
|
## ▶️ Backend starten
|
||||||
|
|
||||||
Dieser Command startet das Backend nachdem es korrekt installiert wurde.
|
Dieser Befehl startet das Backend, nachdem es korrekt installiert wurde:
|
||||||
|
DB in Docker
|
||||||
|
|
||||||
```
|
```bash
|
||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
Die Swagger Doku ist unter [/api-docs](http://localhost:3000/api-docs/)
|
DB nicht in Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn start-no-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
Die Swagger-Dokumentation findest du unter:
|
||||||
|
[http://localhost:3000/api-docs](http://localhost:3000/api-docs)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🛠️ Installation
|
## 🛠️ Installation
|
||||||
|
|
||||||
### 1. PostgreSQL installieren
|
### 🚀 Installation mit Docker
|
||||||
|
|
||||||
#### 🔹 Windows
|
1. [Docker installieren](https://www.docker.com/)
|
||||||
|
2. Installations-Skript ausführen:
|
||||||
|
|
||||||
PostgreSQL kannst du [hier herunterladen](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads).
|
```bash
|
||||||
|
yarn install-script
|
||||||
|
```
|
||||||
|
|
||||||
#### 🔹 Linux
|
---
|
||||||
|
|
||||||
Einfach über den Paketmanager deiner Wahl installieren. Danach den PostgreSQL-Dienst aktivieren (logischischerweise nur wenn du `systemd` verwendest):
|
### 🧱 Manuelle Installation
|
||||||
|
|
||||||
|
#### 1. PostgreSQL installieren
|
||||||
|
|
||||||
|
##### 🔹 Windows
|
||||||
|
|
||||||
|
PostgreSQL kannst du hier herunterladen:
|
||||||
|
[https://www.enterprisedb.com/downloads/postgres-postgresql-downloads](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads)
|
||||||
|
|
||||||
|
##### 🔹 Linux
|
||||||
|
|
||||||
|
PostgreSQL über deinen Paketmanager installieren. Danach den Dienst aktivieren:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo systemctl enable postgresql --now
|
sudo systemctl enable postgresql --now
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. In eine SQL-Shell wechseln
|
---
|
||||||
|
|
||||||
🔹 Windows
|
#### 2. In eine SQL-Shell wechseln
|
||||||
|
|
||||||
Folgenden Befehl ausführen, um als PostgreSQL-Benutzer in die psql-Shell zu gelangen:
|
##### 🔹 Windows
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
psql
|
psql
|
||||||
```
|
```
|
||||||
|
|
||||||
🔹 Linux
|
##### 🔹 Linux
|
||||||
|
|
||||||
Folgenden Befehl ausführen, um als PostgreSQL-Benutzer in die psql-Shell zu gelangen:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo -iu postgres psql
|
sudo -iu postgres psql
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Benutzer und Datenbank in PostgreSQL anlegen
|
---
|
||||||
|
|
||||||
In der geöffneten psql-Shell folgenden Befehl ausführen.
|
#### 3. Benutzer und Datenbank anlegen
|
||||||
|
|
||||||
```bash
|
In der geöffneten psql-Shell:
|
||||||
|
|
||||||
|
```sql
|
||||||
CREATE DATABASE prisma;
|
CREATE DATABASE prisma;
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. .env-Datei vorbereiten
|
---
|
||||||
|
|
||||||
Die Datei .env.example in .env umbenennen und dein Passwort dort eintragen.
|
#### 4. .env-Datei vorbereiten
|
||||||
Außerdem solltest du das Token secret ändern.
|
|
||||||
|
|
||||||
### 5. Prisma vorbereiten
|
- Die Datei `.env.example` in `.env` umbenennen
|
||||||
|
- Passwort und Token-Secret anpassen
|
||||||
|
|
||||||
Im Projektordner folgenden Befehl ausführen, um Prisma-Client zu generieren:
|
---
|
||||||
|
|
||||||
|
#### 5. Prisma vorbereiten
|
||||||
|
|
||||||
|
Im Projektordner folgenden Befehl ausführen, um den Prisma-Client zu generieren:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn prisma generate
|
yarn prisma generate
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6. Datenbank initialisieren
|
---
|
||||||
|
|
||||||
Dieser Command erstellt die DB nach der Datei `schema.prisma`
|
#### 6. Datenbank initialisieren
|
||||||
|
|
||||||
|
Dies erstellt die Datenbank anhand der `schema.prisma`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn prisma migrate dev --name init
|
yarn prisma migrate dev --name init
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Wenn du möchtest, kann ich die Doku auch automatisch auf Englisch übersetzen oder als `README.md` formatieren. Sag einfach Bescheid!
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"node": "^22.15.0",
|
"node": "^22.15.0",
|
||||||
"pg": "^8.15.6",
|
"pg": "^8.15.6",
|
||||||
|
"readline-sync": "^1.4.10",
|
||||||
"swagger-jsdoc": "^6.2.8",
|
"swagger-jsdoc": "^6.2.8",
|
||||||
"swagger-ui-express": "^5.0.1",
|
"swagger-ui-express": "^5.0.1",
|
||||||
"zod": "^3.24.4"
|
"zod": "^3.24.4"
|
||||||
|
|
|
@ -27,6 +27,7 @@ while (!postgresPassword) {
|
||||||
});
|
});
|
||||||
!postgresPassword && console.log("Password cannot be empty");
|
!postgresPassword && console.log("Password cannot be empty");
|
||||||
}
|
}
|
||||||
|
// getting user input for .env file
|
||||||
const jwtSecret: string = crypto.randomBytes(32).toString("hex"); // 64 Zeichen
|
const jwtSecret: string = crypto.randomBytes(32).toString("hex"); // 64 Zeichen
|
||||||
const env: string = `DATABASE_URL="postgresql://${postgresUser}:${postgresPassword}@localhost:5432/prisma"
|
const env: string = `DATABASE_URL="postgresql://${postgresUser}:${postgresPassword}@localhost:5432/prisma"
|
||||||
TOKEN_SECRET="${jwtSecret}"
|
TOKEN_SECRET="${jwtSecret}"
|
||||||
|
@ -38,13 +39,14 @@ try {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error writing to file:", err);
|
console.error("Error writing to file:", err);
|
||||||
}
|
}
|
||||||
|
// running the commands from the JSON file
|
||||||
|
// The commands are executed in the order they are defined in the JSON file
|
||||||
(async () => {
|
(async () => {
|
||||||
for (const command of config.commands) {
|
for (const command of config.commands) {
|
||||||
try {
|
try {
|
||||||
const { stdout, stderr } = await execPromise(command); // Wait for the command to finish
|
const { stdout, stderr } = await execPromise(command); // Wait for the command to finish
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
console.log(`stderr: ${stderr}`);
|
console.log(stderr);
|
||||||
}
|
}
|
||||||
console.log(stdout); // Print the output of the command`);
|
console.log(stdout); // Print the output of the command`);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
@ -56,8 +58,6 @@ try {
|
||||||
fs.writeFile(json_path, JSON.stringify(config), (err) => {
|
fs.writeFile(json_path, JSON.stringify(config), (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error("Error writing to file:", err);
|
console.error("Error writing to file:", err);
|
||||||
} else {
|
|
||||||
console.log("File has been updated successfully.");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("Installation complete");
|
console.log("Installation complete");
|
||||||
|
|
|
@ -1312,6 +1312,11 @@ readdirp@~3.6.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
picomatch "^2.2.1"
|
picomatch "^2.2.1"
|
||||||
|
|
||||||
|
readline-sync@^1.4.10:
|
||||||
|
version "1.4.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.10.tgz#41df7fbb4b6312d673011594145705bf56d8873b"
|
||||||
|
integrity sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==
|
||||||
|
|
||||||
resolve@^1.0.0:
|
resolve@^1.0.0:
|
||||||
version "1.22.10"
|
version "1.22.10"
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39"
|
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue