X-Git-Url: https://git.kengrimes.com/?p=henge%2Fkiak.git;a=blobdiff_plain;f=router.js;fp=router.js;h=2f0441ae6e4f28c721624dc9bca66ccf282ae905;hp=0000000000000000000000000000000000000000;hb=49487d947260500f71a7e125c705cef45e998db2;hpb=bf0ef83964741dcd64d27a8da651e65beba7e451 diff --git a/router.js b/router.js new file mode 100644 index 0000000..2f0441a --- /dev/null +++ b/router.js @@ -0,0 +1,22 @@ +/** + * @file HTTP(S) Router that treats the first directory in a URL's path as + * a route to a host. + * @author Ken Grimes + * @version 0.0.1 + * @license AGPL-3.0 + * @copyright jk software 2017 + */ +const fs = require('fs') + +module.exports = (opts) => { + const startHttpd = (listener) => { + if (opts['no-tls']) + return require('http').createServer(listener) + if (fs.existsSync(opts['ca-cert'])) + + } + return { + httpd: startHttpd(), + wsd: startWsd() + } +}