test-ready
[henge/kiak.git] / strapp.js
diff --git a/strapp.js b/strapp.js
new file mode 100644 (file)
index 0000000..ebca88d
--- /dev/null
+++ b/strapp.js
@@ -0,0 +1,27 @@
+/**
+* @file      Node entry and main driver
+* @author    Jordan Lavatai, Ken Grimes
+* @version   0.0.1
+* @license   AGPL-3.0
+* @copyright loljk 2017
+* @summ ary   HTTP(S) Router that uses the first directory in the requested URL
+*            as the route name
+*/
+const opts = require('./opts.js')
+const router = require('./router.js')
+
+Object.keys(opts['bindings']).forEach((key) => {
+  router.createBind(key, opts['bindings'].key)
+})
+
+router.startHttpServer({
+  port: opts['port'],
+  skelFile: './skel.html',
+  clientJS: opts['client-js'],
+  hostJS: opts['host-js'],
+  httpdRoot: opts['file-dir'],
+  tls: {
+    certFile: opts['ca-cert'],
+    keyFile: opts['ca-key']
+  }
+})