Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. const express = require('express');
  2. const https = require('https');
  3. const fs = require('fs');
  4.  
  5. const PORT = 443;
  6. const CREDENTIALS = {
  7. key: fs.readFileSync('ssl.key'),
  8. cert: fs.readFileSync('ssl.cert')
  9. };
  10.  
  11. const app = express();
  12.  
  13. app.use(express.static(`${__dirname}/public`))
  14.  
  15. app.get('*', (req, res) => {
  16. res.end(`${__dirname}/public/index.html`);
  17. });
  18.  
  19. https.createServer(CREDENTIALS, app).listen(PORT, () => {
  20. console.log(`You are now listening on port ${PORT}`)
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement