fix: TypeError: Class constructor Application cannot be invoked without 'new' #3

Merged
coolaj86 merged 1 commits from :master into master 2019-01-15 06:00:39 +00:00
1 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ var greenlock = require('greenlock-koa').create({
var http = require('http'); var http = require('http');
var https = require('https'); var https = require('https');
var koa = require('koa'); var koa = require('koa');
var app = koa(); var app = new koa();
app.use(function *() { app.use(function *() {
this.body = 'Hello World'; this.body = 'Hello World';
@ -84,7 +84,7 @@ server.listen(443, function () {
// http redirect to https // http redirect to https
var http = require('http'); var http = require('http');
var redirectHttps = koa().use(require('koa-sslify')()).callback(); var redirectHttps = app.use(require('koa-sslify')()).callback();
http.createServer(greenlock.middleware(redirectHttps)).listen(80, function () { http.createServer(greenlock.middleware(redirectHttps)).listen(80, function () {
console.log('Listening on port 80 to handle ACME http-01 challenge and redirect to https'); console.log('Listening on port 80 to handle ACME http-01 challenge and redirect to https');
}); });