Updated server JS with new clog statements to ensure deployments are functioning.

This commit is contained in:
Patrick Fic
2020-10-06 21:32:15 -07:00
parent 73bfd798e6
commit e44ddf5a35

View File

@@ -36,6 +36,7 @@ app.post("/sendemail", fb.validateFirebaseIdToken, sendEmail.sendEmail);
//Test route to ensure Express is responding.
app.get("/test", async function (req, res) {
console.log("Incoming request verified.", req);
res.status(200).send("OK");
});
const test = require("./server/_test/test.js");
@@ -129,50 +130,14 @@ var qbo = require("./server/accounting/qbo/qbo");
app.post("/qbo/authorize", qbo.authorize);
app.get("/qbo/callback", qbo.callback);
//Serve React App if in Production
// if (process.env.NODE_ENV === "production") {
// app.use(express.static(path.join(__dirname, "client/build")));
// app.use(express.static(path.join(__dirname, "admin/build")));
// app.get("/service-worker.js", (req, res) => {
// res.sendFile(path.resolve(__dirname, "client/build", "service-worker.js"));
// });
// app.get("/admin*", function (req, res) {
// res.sendFile(path.join(__dirname, "admin/build", "index.html"));
// });
// app.get("*", function (req, res) {
// res.sendFile(path.join(__dirname, "client/build", "index.html"));
// });
// }
if (process.env.NODE_ENV === "production") {
app.listen(port, (error) => {
if (error) throw error;
console.log("[PRODUCTION] Server running on port " + port);
console.log("AWS - [PRODUCTION] Server running on port " + port);
});
} else {
app.listen(port, (error) => {
if (error) throw error;
console.log("[DEVELOPMENT] Non Secured Server running on port " + port);
});
// https
// .createServer(
// {
// key: fs.readFileSync("./key.pem"),
// cert: fs.readFileSync("./cert.pem"),
// passphrase: "Wl0d8k@!",
// },
// app
// )
// .listen(port, (error) => {
// if (error) throw error;
// console.log("[DEV/STAGING] Mock HTTPS Server running on port " + port);
// });
}
// app.listen(port, error => {
// if (error) throw error;
// console.log("Server running on port " + port);
// });