Skip to content

SSL #277

Answered by ZanQ
ZanQ asked this question in Q&A
SSL #277
Nov 7, 2023 · 1 comment
Discussion options

You must be logged in to vote

For those looking for help on how to setup SSL with this boilerplate, this is what I did to get it working:

In the index.js file:

var https = require('https');
var fs = require('fs');

//SSL Files
var httpsOptions = {
key: fs.readFileSync('./src/cert/privkey.pem'), //My path to the private key file
cert: fs.readFileSync('./src/cert/fullchain.pem'), //My path to the full chain file
ca: fs.readFileSync('./src/cert/chain.pem') //My path to the first chain file
}

let server;
server = https.createServer(httpsOptions, app); //This is where the server is initialized

mongoose.connect(config.mongoose.url, config.mongoose.options).then(() => {
logger.info('Connected to MongoDB');

/*Changed this part…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ZanQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant