greenlock-express.js/examples/simple.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-08-16 17:05:41 +00:00
'use strict';
2017-01-25 22:02:16 +00:00
//require('greenlock-express')
2016-08-16 17:05:41 +00:00
require('../').create({
2018-04-20 04:18:34 +00:00
// Let's Encrypt v2 is ACME draft 11
version: 'draft-11'
2016-08-16 17:05:41 +00:00
2018-05-19 23:54:08 +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
2018-04-20 04:18:34 +00:00
// You MUST change this to a valid email address
2016-08-16 17:26:54 +00:00
, email: 'john.doe@example.com'
2016-08-16 17:05:41 +00:00
2018-04-20 04:18:34 +00:00
// You MUST NOT build clients that accept the ToS without asking the user
2016-08-16 17:05:41 +00:00
, agreeTos: true
2018-04-20 04:18:34 +00:00
// You MUST change these to valid domains
// NOTE: all domains will validated and listed on the certificate
, approveDomains: [ 'example.com', 'www.example.com' ]
// You MUST have access to write to directory where certs are saved
// ex: /home/foouser/acme/etc
2018-07-03 09:25:12 +00:00
, configDir: '~/.config/acme/'
2016-08-16 17:05:41 +00:00
, app: require('express')().use('/', function (req, res) {
2018-04-24 17:33:52 +00:00
res.setHeader('Content-Type', 'text/html; charset=utf-8');
2018-04-20 04:18:34 +00:00
res.end('Hello, World!\n\n💚 🔒.js');
2016-08-16 17:05:41 +00:00
})
2018-05-10 06:53:45 +00:00
// Get notified of important updates and help me make greenlock better
, communityMember: true
2018-04-20 04:18:34 +00:00
//, debug: true
2016-08-16 17:05:41 +00:00
}).listen(80, 443);