diff --git a/docker-compose.yml b/docker-compose.yml
index a087b14..1cc0978 100755
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,21 +3,25 @@ version: '3'
services:
nginx:
container_name: nginx
- depends_on:
- - app
+ # depends_on:
+ # - app
restart: always
build: ./nginx
image: custom/nginx
- ports:
- - 80:80
+ # ports:
+ # - 80:80
+ links:
+ - app
+ - prometheus
networks:
- network_1
nginx2:
container_name: nginx2
restart: always
- image: nginx
- expose:
- - "80"
+ build: ./nginx2
+ image: custom/nginx2
+ ports:
+ - 80:80
networks:
- network_1
app:
@@ -27,6 +31,8 @@ services:
restart: always
build: ./node
image: custom/node
+ ports:
+ - 3001:3001
networks:
- network_1
# - network_2
diff --git a/nginx2/Dockerfile b/nginx2/Dockerfile
new file mode 100644
index 0000000..8f74bfc
--- /dev/null
+++ b/nginx2/Dockerfile
@@ -0,0 +1,5 @@
+FROM nginx
+
+COPY nginx.conf /etc/nginx/nginx.conf
+
+COPY ./html/ /data/www/
\ No newline at end of file
diff --git a/nginx2/index.html b/nginx2/html/index.html
similarity index 91%
rename from nginx2/index.html
rename to nginx2/html/index.html
index a46c22d..2c5accb 100644
--- a/nginx2/index.html
+++ b/nginx2/html/index.html
@@ -5,7 +5,7 @@
-
+
\ No newline at end of file
diff --git a/nginx2/html/yay.html b/nginx2/html/yay.html
new file mode 100644
index 0000000..6137f06
--- /dev/null
+++ b/nginx2/html/yay.html
@@ -0,0 +1,8 @@
+
+
+
THOUS HAST SUCCEEDED
+
+ THOU ART LOGGED
+
+
+
\ No newline at end of file
diff --git a/nginx2/nginx.conf b/nginx2/nginx.conf
new file mode 100644
index 0000000..7ac6bcd
--- /dev/null
+++ b/nginx2/nginx.conf
@@ -0,0 +1,11 @@
+worker_processes 1;
+
+events { worker_connections 1024; }
+
+http {
+ server {
+ location / {
+ root /data/www;
+ }
+ }
+}
\ No newline at end of file
diff --git a/node/app.js b/node/app.js
index b3675af..894e3ca 100755
--- a/node/app.js
+++ b/node/app.js
@@ -9,6 +9,7 @@ const Prometheus = require('prom-client');
const fs = require('file-system');
const marked = require('marked');
const jwt = require('jsonwebtoken');
+const bodyParser= require('body-parser');
// database connection (with retries)
const options = {
@@ -84,7 +85,8 @@ app.get('/metrics2', function(req, res){
})
// JWT generation
-app.use(express.json());
+// app.use(express.json());
+app.use(bodyParser.urlencoded({ extended: false }));
app.post('/token', function(req, res){
console.log(req.body);
console.log(req.body.username);
@@ -94,15 +96,18 @@ app.post('/token', function(req, res){
var token = jwt.sign(req.body, 'wowmuchsecretveryhiddenwow');
console.log(token);
// res.json(token);
- res.status(200).json({
- success: 'SUCCESS! You\'re in.',
- token: token
- });
+ // res.status(200).json({
+ // success: 'SUCCESS! You\'re in.',
+ // token: token
+ // });
+ res.redirect('http://localhost/yay.html');
} else {
- res.status(500).send('this is not the password I expected');
+ // res.status(500).send('this is not the password I expected');
+ res.redirect('http://localhost/nay.html');
}
} else {
- res.status(500).send('this is not the user I want');;
+ // res.status(500).send('this is not the user I want');
+ res.redirect('http://localhost/nay.html');
}
});