const express = require('express');
const app = new express();
const https = require('https');
const fs = require('fs');
const path = require('path');

console.log(fs.readFileSync);

const options = {
  key: fs.readFileSync(path.resolve(__dirname, './ssl/gaarahan.key')),
  // cert: fs.readFileSync('./ssl/gaarahan.cert'),
  cert: fs.readFileSync(path.resolve(__dirname, './ssl/gaarahan.cert')),
  requestCert: false,
  rejectUnauthorized: false
};
app.get('/', (req, res) => {
  console.log('got');
  res.sendFile(path.resolve(__dirname, './index.html'));
});
const server = https.createServer(options, app);

server.listen(8888, () => {
  console.log('listening https://192.164.20.21:8888/');
});
