Changed error handling for expired tokens. Changed document upload component. Adjusted express server order.

This commit is contained in:
Patrick Fic
2020-01-16 09:55:16 -08:00
parent 2971c72f76
commit 26d56caf4e
4 changed files with 102 additions and 97 deletions

View File

@@ -18,6 +18,14 @@ app.use(bodyParser.urlencoded({ extended: true }));
app.use(enforce.HTTPS({ trustProtoHeader: true }));
app.use(cors());
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 });
});
if (process.env.NODE_ENV === "production") {
app.use(express.static(path.join(__dirname, "client/build")));
@@ -30,18 +38,10 @@ 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 });
});
if (process.env.NODE_ENV === "production") {
app.listen(port, error => {
if (error) throw error;
console.log("Server running on port " + port);
console.log("[PRODUCTION] Server running on port " + port);
});
} else {
https
@@ -53,7 +53,10 @@ if (process.env.NODE_ENV === "production") {
},
app
)
.listen(port);
.listen(port, error => {
if (error) throw error;
console.log("[DEV/STAGING] Mock HTTPS Server running on port " + port);
});
}
// app.listen(port, error => {