„init.sh“ ändern
This commit is contained in:
11
init.sh
11
init.sh
@@ -3,7 +3,9 @@
|
||||
# Bestimme das aktuelle Verzeichnis
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
DIR_NAME=$(basename "$DIR")
|
||||
DIR_NAME=$(echo "$DIR_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_-]//g' | tr ' ' '_')
|
||||
|
||||
echo "Angepasster Name: $DIR_NAME"
|
||||
# Entferne vorhandenes Git-Repository, falls vorhanden
|
||||
rm -rf .git
|
||||
|
||||
@@ -23,7 +25,6 @@ mkdir -p backend/src
|
||||
npm init -y --prefix backend
|
||||
|
||||
# Installiere die notwendigen Backend-Abhängigkeiten inklusive TypeScript und Typendefinitionen
|
||||
npm i --prefix backend express dotenv @types/express @types/dotenv typescript ts-node
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +63,7 @@ dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const NODE_ENV = process.env.NODE_ENV || 'dev';
|
||||
const Port = NODE_ENV === "production" ? parseInt(process.env.PORT || '') || 507 : 2210;
|
||||
const Port = NODE_ENV === "production" ? parseInt(process.env.PORT || '') || 2210 : 2210;
|
||||
|
||||
app.listen(Port, () => {
|
||||
console.log(\`Server läuft auf Port \${Port}\`);
|
||||
@@ -80,7 +81,7 @@ services:
|
||||
- Backend
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.$DIR_NAME.rule=Host(\`${DIR_NAME}.example.com\`)"
|
||||
- "traefik.http.routers.$DIR_NAME.rule=Host(\`${DIR_NAME}.csnetworkx.dev\`)"
|
||||
- "traefik.http.routers.$DIR_NAME.entrypoints=websecure"
|
||||
- "traefik.http.services.$DIR_NAME.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.$DIR_NAME.service=$DIR_NAME"
|
||||
@@ -90,7 +91,9 @@ networks:
|
||||
external: true
|
||||
EOF
|
||||
|
||||
npm i --prefix backend express dotenv @types/express @types/dotenv
|
||||
npm i --prefix backend --save-dev nodemon typescript ts-node
|
||||
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial template setup"
|
||||
git commit -m "Initial template setup"
|
||||
Reference in New Issue
Block a user