Manual path authorization for server.

This commit is contained in:
Patrick Fic
2020-08-24 11:48:34 -07:00
parent 0bf53dcccc
commit dabc8892b9

View File

@@ -23,7 +23,7 @@ const app = express();
const port = process.env.PORT || 5000; const port = process.env.PORT || 5000;
//const port = 5000; //const port = 5000;
app.use(fb.validateFirebaseIdToken); //app.use(fb.validateFirebaseIdToken);
app.use(compression()); app.use(compression());
app.use(bodyParser.json({ limit: "50mb" })); app.use(bodyParser.json({ limit: "50mb" }));
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true })); app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
@@ -32,7 +32,7 @@ app.use(cors());
//Email Based Paths. //Email Based Paths.
var sendEmail = require("./sendemail.js"); var sendEmail = require("./sendemail.js");
app.post("/sendemail", sendEmail.sendEmail); app.post("/sendemail", fb.validateFirebaseIdToken, sendEmail.sendEmail);
//Test route to ensure Express is responding. //Test route to ensure Express is responding.
app.get("/test", async function (req, res) { app.get("/test", async function (req, res) {
@@ -43,18 +43,38 @@ app.post("/test", test.testResponse);
//Accounting-IIF //Accounting-IIF
const accountingIIF = require("./server/accounting/iif/iif"); const accountingIIF = require("./server/accounting/iif/iif");
app.post("/accounting/iif/receivables", accountingIIF.receivables); app.post(
"/accounting/iif/receivables",
fb.validateFirebaseIdToken,
accountingIIF.receivables
);
//Accounting Qbxml //Accounting Qbxml
const accountQbxml = require("./server/accounting/qbxml/qbxml"); const accountQbxml = require("./server/accounting/qbxml/qbxml");
app.post("/accounting/qbxml/receivables", accountQbxml.receivables); app.post(
app.post("/accounting/qbxml/payables", accountQbxml.payables); "/accounting/qbxml/receivables",
app.post("/accounting/qbxml/payments", accountQbxml.payments); fb.validateFirebaseIdToken,
accountQbxml.receivables
);
app.post(
"/accounting/qbxml/payables",
fb.validateFirebaseIdToken,
accountQbxml.payables
);
app.post(
"/accounting/qbxml/payments",
fb.validateFirebaseIdToken,
accountQbxml.payments
);
//Cloudinary Media Paths //Cloudinary Media Paths
var media = require("./server/media/media"); var media = require("./server/media/media");
app.post("/media/sign", media.createSignedUploadURL); app.post(
app.post("/media/download", media.downloadFiles); "/media/sign",
fb.validateFirebaseIdToken,
media.createSignedUploadURL
);
app.post("/media/download", fb.validateFirebaseIdToken, media.downloadFiles);
//SMS/Twilio Paths //SMS/Twilio Paths
var smsReceive = require("./server/sms/receive"); var smsReceive = require("./server/sms/receive");
@@ -64,7 +84,7 @@ app.post(
smsReceive.receive smsReceive.receive
); );
var smsSend = require("./server/sms/send"); var smsSend = require("./server/sms/send");
app.post("/sms/send", smsSend.send); app.post("/sms/send", fb.validateFirebaseIdToken, smsSend.send);
var smsStatus = require("./server/sms/status"); var smsStatus = require("./server/sms/status");
app.post( app.post(
"/sms/status", "/sms/status",
@@ -73,26 +93,34 @@ app.post(
); );
var job = require("./server/job/job"); var job = require("./server/job/job");
app.post("/job/totals", job.totals); app.post("/job/totals", fb.validateFirebaseIdToken, job.totals);
//Scheduling //Scheduling
var scheduling = require("./server/scheduling/scheduling-job"); var scheduling = require("./server/scheduling/scheduling-job");
app.post("/scheduling/job", scheduling.job); app.post("/scheduling/job", fb.validateFirebaseIdToken, scheduling.job);
//Handlebars Paths for Email/Report Rendering //Handlebars Paths for Email/Report Rendering
var renderHandlebars = require("./server/render/renderHandlebars"); var renderHandlebars = require("./server/render/renderHandlebars");
app.post("/render", renderHandlebars.render); app.post("/render", fb.validateFirebaseIdToken, renderHandlebars.render);
app.post("/notifications/send", fb.sendNotification); app.post(
"/notifications/send",
fb.validateFirebaseIdToken,
fb.sendNotification
);
//Stripe Processing //Stripe Processing
var stripe = require("./server/stripe/payment"); var stripe = require("./server/stripe/payment");
app.post("/stripe/payment", stripe.payment); app.post("/stripe/payment", fb.validateFirebaseIdToken, stripe.payment);
app.post("/stripe/mobilepayment", stripe.mobile_payment); app.post(
"/stripe/mobilepayment",
fb.validateFirebaseIdToken,
stripe.mobile_payment
);
//Tech Console //Tech Console
var tech = require("./server/tech/tech"); var tech = require("./server/tech/tech");
app.post("/tech/login", tech.techLogin); app.post("/tech/login", fb.validateFirebaseIdToken, tech.techLogin);
var utils = require("./server/utils/utils"); var utils = require("./server/utils/utils");
app.post("/utils/time", utils.servertime); app.post("/utils/time", utils.servertime);