greenlock-express.js/examples/quickstart.js

39 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2019-06-03 09:47:07 +00:00
"use strict";
2016-08-16 17:05:41 +00:00
2017-01-25 22:02:16 +00:00
//require('greenlock-express')
2019-06-03 09:47:07 +00:00
require("../")
.create({
// Let's Encrypt v2 is ACME draft 11
version: "draft-11",
2016-08-16 17:05:41 +00:00
2019-06-03 09:47:07 +00:00
server: "https://acme-v02.api.letsencrypt.org/directory",
// Note: If at first you don't succeed, stop and switch to staging
// https://acme-staging-v02.api.letsencrypt.org/directory
2016-08-16 17:05:41 +00:00
2019-06-03 09:47:07 +00:00
// You MUST change this to a valid email address
email: "john.doe@example.com",
2018-04-20 04:18:34 +00:00
2019-06-03 09:47:07 +00:00
// You MUST NOT build clients that accept the ToS without asking the user
agreeTos: true,
2016-08-16 17:05:41 +00:00
2019-06-03 09:47:07 +00:00
// You MUST change these to valid domains
// NOTE: all domains will validated and listed on the certificate
approvedDomains: ["example.com", "www.example.com"],
2016-08-16 17:05:41 +00:00
2019-06-03 09:47:07 +00:00
// You MUST have access to write to directory where certs are saved
// ex: /home/foouser/acme/etc
configDir: "~/.config/acme/",
store: require("greenlock-store-fs"),
2018-04-20 04:18:34 +00:00
2019-06-03 09:47:07 +00:00
app: require("express")().use("/", function(req, res) {
res.setHeader("Content-Type", "text/html; charset=utf-8");
res.end("Hello, World!\n\n💚 🔒.js");
}),
2016-08-16 17:05:41 +00:00
2019-06-03 09:47:07 +00:00
// Get notified of important updates and help me make greenlock better
communityMember: true
2016-08-16 17:05:41 +00:00
2019-06-03 09:47:07 +00:00
//, debug: true
})
.listen(80, 443);