Implement backend https

This commit is contained in:
Rene Vergara 2021-11-08 13:09:16 -06:00
parent 0a4dda4d73
commit f33666bd0e
2 changed files with 14 additions and 4 deletions

View file

@ -1,6 +1,6 @@
const express = require('express'); const express = require('express');
const bodyparser = require('body-parser');
const app = express(); const app = express();
const bodyparser = require('body-parser');
const postmodel = require('./models/post'); const postmodel = require('./models/post');
const usermodel = require('./models/user'); const usermodel = require('./models/user');
const ownermodel = require('./models/owner'); const ownermodel = require('./models/owner');

View file

@ -1,9 +1,19 @@
const http = require('http'); var fs = require('fs');
var http = require('http');
//var https = require('https');
//var certificate = fs.readFileSync('/etc/letsencrypt/live/zgo.cash/fullchain.pem');
//var privateKey = fs.readFileSync('/etc/letsencrypt/live/zgo.cash/privkey.pem');
//var credentials = {key: privateKey, cert: certificate};
const app = require('./backend/app'); const app = require('./backend/app');
const port = 3000; const port = 3000;
app.set('port', port); app.set('port', port);
const server = http.createServer(app); const httpServer = http.createServer(app);
//const httpsServer = https.createServer(credentials, app);
server.listen(port); httpServer.listen(port);
//httpsServer.listen(port);