summaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-05-22 17:35:28 -0700
committerMatthew Miller <matthew@millerti.me>2020-05-22 17:35:28 -0700
commitc3d03778eb03a9c4bdeb821e7b6f741c83af16cc (patch)
treea7291fb6df7ccdd3d7c460158ef09b8b527d56e7 /example
parent91b2b0bbea06e8a0b56ffa949dc2ed26745d07da (diff)
Add some docs to example server
Diffstat (limited to 'example')
-rw-r--r--example/index.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/example/index.js b/example/index.js
index c9ac80e..67bcced 100644
--- a/example/index.js
+++ b/example/index.js
@@ -1,3 +1,8 @@
+/**
+ * An example Express server showing off a simple integration of @webauthntine/server.
+ *
+ * The webpages served from ./public use @webauthntine/browser.
+ */
const https = require('https');
const fs = require('fs');
@@ -135,6 +140,13 @@ app.post('/verify-assertion', (req, res) => {
});
https.createServer({
+ /**
+ * You'll need to provide a SSL cert and key here because
+ * WebAuthn can only be run from HTTPS:// URLs
+ *
+ * HINT: If you create a `dev` subdomain A-record that points to 127.0.0.1,
+ * you can manually generate an HTTPS certificate for it using Let's Encrypt certbot.
+ */
key: fs.readFileSync('./dev.yourdomain.com.key'),
cert: fs.readFileSync('./dev.yourdomain.com.crt'),
}, app).listen(port, host, () => {