Skip to content
Snippets Groups Projects
Commit d3929cb7 authored by Alexander Tim Hobelsberger's avatar Alexander Tim Hobelsberger
Browse files

SSL

parent a300e853
No related branches found
No related tags found
1 merge request!10Skalierbarkeit
...@@ -18,7 +18,6 @@ const server = http.createServer(app); ...@@ -18,7 +18,6 @@ const server = http.createServer(app);
const { Server } = require("socket.io"); const { Server } = require("socket.io");
const io = new Server(server, { const io = new Server(server, {
cors: { cors: {
origin: "*",
methods: ["GET", "POST"], methods: ["GET", "POST"],
transports: ['websocket', 'polling'], transports: ['websocket', 'polling'],
credentials: true credentials: true
...@@ -35,12 +34,14 @@ const User = require('./models/user'); ...@@ -35,12 +34,14 @@ const User = require('./models/user');
var port = process.env.PORT || 3000; var port = process.env.PORT || 3000;
const redis = require('socket.io-redis'); const redis = require('socket.io-redis');
const { createClient } = require('redis'); const { createClient } = require('redis');
const { createAdapter } = require('@socket.io/redis-adapter'); const { createAdapter } = require('@socket.io/redis-adapter')
var cors = require('cors');
/* /*
const pubClient = createClient({ host: 'redis-server', port: 6379}); const pubClient = createClient({ host: 'redis-server', port: 6379});
const subClient = pubClient.duplicate(); const subClient = pubClient.duplicate();
io.adapter(createAdapter(pubClient, subClient)); */ io.adapter(createAdapter(pubClient, subClient)); */
app.use(cors());
(async () => { (async () => {
pubClient = createClient({ url: "redis://redis-server:6379" }); pubClient = createClient({ url: "redis://redis-server:6379" });
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"@socket.io/redis-adapter": "^8.0.0", "@socket.io/redis-adapter": "^8.0.0",
"bcrypt": "^5.1.0", "bcrypt": "^5.1.0",
"body-parser": "^1.20.1", "body-parser": "^1.20.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"express": "^4.18.2", "express": "^4.18.2",
"fs": "*", "fs": "*",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"@socket.io/redis-adapter": "^8.0.0", "@socket.io/redis-adapter": "^8.0.0",
"bcrypt": "^5.1.0", "bcrypt": "^5.1.0",
"body-parser": "^1.20.1", "body-parser": "^1.20.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"express": "^4.18.2", "express": "^4.18.2",
"fs": "*", "fs": "*",
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
redirect: 'follow' redirect: 'follow'
}; };
fetch("http://localhost:3600/login", requestOptions) fetch("https://localhost/login", requestOptions)
.then(response => response.json()) .then(response => response.json())
.then((result) => { .then((result) => {
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
redirect: 'follow' redirect: 'follow'
}; };
fetch("http://localhost:3600/authenticate", requestOptions) fetch("https://localhost/authenticate", requestOptions)
.then((response) => { .then((response) => {
if (response.status === 200) { if (response.status === 200) {
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
redirect: 'follow' redirect: 'follow'
}; };
fetch("http://localhost:3600/register", requestOptions) fetch("https://localhost/register", requestOptions)
.then((response) => { .then((response) => {
if(response.ok){ if(response.ok){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment