Fixed scaling of images. Fixed server.js issues for production
This commit is contained in:
28
server.js
28
server.js
@@ -6,8 +6,8 @@ const compression = require("compression");
|
||||
var enforce = require("express-sslify");
|
||||
if (process.env.NODE_ENV !== "production") require("dotenv").config();
|
||||
|
||||
const https = require('https');
|
||||
const fs = require('fs');
|
||||
const https = require("https");
|
||||
const fs = require("fs");
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 5000;
|
||||
@@ -32,17 +32,29 @@ if (process.env.NODE_ENV === "production") {
|
||||
|
||||
var s3upload = require("./s3upload");
|
||||
app.post("/sign_s3", s3upload.sign_s3);
|
||||
app.get("/sign_s3", s3upload.get_s3);
|
||||
|
||||
app.get("/test", function(req, res) {
|
||||
res.json({ success: true });
|
||||
});
|
||||
|
||||
https.createServer({
|
||||
key: fs.readFileSync('./key.pem'),
|
||||
cert: fs.readFileSync('./cert.pem'),
|
||||
passphrase: 'Wl0d8k@!'
|
||||
}, app)
|
||||
.listen(5000);
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
app.listen(port, error => {
|
||||
if (error) throw error;
|
||||
console.log("Server running on port " + port);
|
||||
});
|
||||
} else {
|
||||
https
|
||||
.createServer(
|
||||
{
|
||||
key: fs.readFileSync("./key.pem"),
|
||||
cert: fs.readFileSync("./cert.pem"),
|
||||
passphrase: "Wl0d8k@!"
|
||||
},
|
||||
app
|
||||
)
|
||||
.listen(port);
|
||||
}
|
||||
|
||||
// app.listen(port, error => {
|
||||
// if (error) throw error;
|
||||
|
||||
Reference in New Issue
Block a user