Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. var express = require('express');
  2. var app = express();
  3. var helmet = require('helmet');
  4. var db = require('./server/database.js');
  5. var fs = require('fs');
  6. var ssl = require('ssl-root-cas');
  7.  
  8. 'use strict';
  9. var rootCas = require('ssl-root-cas/latest').create();
  10.  
  11. // default for all https requests
  12. // (whether using https directly, request, or another module)
  13. require('https').globalAgent.options.ca = rootCas;
  14.  
  15. app.use(helmet());
  16.  
  17. var options = {
  18. key : fs.readFileSync('privkey.pem', 'ascii'),
  19. cert : fs.readFileSync('fullchain.pem', 'ascii')
  20. }
  21.  
  22. app.get('/', function(req, res) {
  23. res.sendFile(__dirname + '/public/index.html');
  24. });
  25. app.use('/public', express.static(__dirname + '/public'));
  26.  
  27. var serv = require('https').createServer(options, app);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement