diff --git a/src/config.js b/src/config.js index 782c6fc..7bc060c 100644 --- a/src/config.js +++ b/src/config.js @@ -12,4 +12,5 @@ module.exports = { user: 'marcus', password: 'marcus', }, + transport: 'http', }; diff --git a/src/http.js b/src/http.js index 87dd386..ca8a319 100644 --- a/src/http.js +++ b/src/http.js @@ -29,5 +29,5 @@ module.exports = (routing, port) => { }) .listen(port); - console.log(`API on port ${port}`); + console.log(`API on http://localhost:${port}/`); }; diff --git a/src/main.js b/src/main.js index 48da82f..9c371a9 100644 --- a/src/main.js +++ b/src/main.js @@ -2,13 +2,13 @@ const fsp = require('node:fs').promises; const path = require('node:path'); -const server = require('./ws.js'); +const config = require('./config.js'); +const server = require(`./${config.transport}.js`); const staticServer = require('./static.js'); const load = require('./load.js'); const db = require('./db.js'); const hash = require('./hash.js'); const logger = require('./logger.js'); -const config = require('./config.js'); const sandbox = { console: Object.freeze(logger), diff --git a/src/ws.js b/src/ws.js index 3e91766..22c33b0 100644 --- a/src/ws.js +++ b/src/ws.js @@ -34,5 +34,5 @@ module.exports = (routing, port) => { }); }); - console.log(`API on http://localhost:${port}/`); + console.log(`API on ws://localhost:${port}/`); };