Wednesday, 10 May 2017

greenlock-express for simple nodejs webapp

I'm trying to setup HTTPS encryption for my nodejs webapp. From what I learned, greenlock-express (formely known as letsencrypt-express) is the easiest way to do it.

My app is pretty simple, but I'm having a hard time to follow the usage instructions from https://git.daplie.com/Daplie/greenlock-express

This is the overall structure of the files:

.
|-- app.json
|-- index.js
|-- node_modules
|-- package.json
|-- Procfile
|-- public
|-- README.md
`-- views

This is the index.js:

var express = require('express');
var app = express();

app.set('port', (process.env.PORT || 5000));

app.use(express.static(__dirname + '/public'));

// views is directory for all template files
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.get('/', function(request, response) {
  response.render('pages/index');
});

app.listen(app.get('port'), function() {
  console.log('Node app is running on port', app.get('port'));
});

How should I proceed?



via Bernardo Rodrigues

No comments:

Post a Comment