Changed error handling for expired tokens. Changed document upload component. Adjusted express server order.
This commit is contained in:
23
server.js
23
server.js
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user