const express = require("express"); const https = require("https"); const fs = require("fs"); const path = require("path"); const socketIO = require("socket.io"); const mysql = require("mysql"); const { query } = require("express"); // Сертификат const cert = fs.readFileSync("certificates/cert.pem"); const ca = fs.readFileSync("certificates/csr.pem"); const key = fs.readFileSync("certificates/key.pem"); const app = express(); const server = https.Server(app); const io = socketIO(server); const conn = mysql.createConnection({ host: "", user: "", database: "", password: "" }); conn.connect(err => { if(err) { console.log(err); } else { console.log("База данных подключена!"); } }); app.set("port", 80); app.use("/static", express.static(__dirname + "/static")); app.get("/", function (request, response) { response.sendFile(path.join(__dirname + "/static", "index.html")); }); server.listen(80, function () { console.log("Server running"); });