diff --git a/docker-compose.yml b/docker-compose.yml index 560ff5e..16f97f2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,4 +19,14 @@ services: - ./data:/usr/src/app/data - /usr/src/app/node_modules - + labels: + - "traefik.enable=true" + - "traefik.http.routers.library-manager.entrypoints=https" + - "traefik.http.routers.library-manager.rule=Host(`library.ghost.tel`)" + - "traefik.http.routers.library-manager.tls.certresolver=http" + networks: + - web + - default +networks: + web: + external: true \ No newline at end of file diff --git a/index.js b/index.js index d4a7dcb..0bdfef5 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ const axios = require('axios'); const express = require('express'); -const https = require('https'); + const fs = require('fs'); const path = require('path'); const sqlite3 = require('sqlite3').verbose(); @@ -26,11 +26,6 @@ const { Op } = require('sequelize'); // Import Sequelize Operators const app = express(); const PORT = process.env.PORT || 3000; -// SSL certificate paths -const privateKey = fs.readFileSync(path.join(__dirname, 'server.key'), 'utf8'); -const certificate = fs.readFileSync(path.join(__dirname, 'server.cert'), 'utf8'); - -const credentials = { key: privateKey, cert: certificate }; // Middleware to parse JSON bodies app.use(express.json()); // Use built-in body-parser for JSON @@ -824,11 +819,8 @@ app.put('/api/books/:id', async (req, res) => { } }); -const httpsServer = https.createServer(credentials, app); - - -httpsServer.listen(PORT, () => { - console.log(`HTTPS Server running on https://localhost:${PORT}`); +app.listen(PORT, () => { + console.log(`HTTP Server running on http://localhost:${PORT}`); }); app.get('/api/books-on-loan', async (req, res) => {