Skip to content

Commit d1137a2

Browse files
Rafeh QaziRafeh Qazi
Rafeh Qazi
authored and
Rafeh Qazi
committed
day 3 build
1 parent db124b3 commit d1137a2

22 files changed

+3578
-45
lines changed

Diff for: .firebase/hosting.YnVpbGQ.cache

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
asset-manifest.json,1599684733907,10e7a3ae61d177c61963fbd6dfb4978d25126b4ba7fc9694f262ae08af7960a5
2-
index.html,1599684733906,083d31e8b8a8806cc09c2a7632747b5165471196852a6fd38740ef22759acae0
3-
precache-manifest.721caefbcc2dfbd753317d2652021dae.js,1599684733907,78e01bccd4f4402f064652fa03dbf59e19ea2449ec67baca43d0deeabb863ca0
4-
favicon.ico,1599684669137,a08fa4488c3ecef62d9effd03b3a989929bdcbecf5e905941f9034a15bd3dba3
5-
manifest.json,1599684669140,341d52628782f8ac9290bbfc43298afccb47b7cbfcee146ae30cf0f46bc30900
6-
logo192.png,1599684669138,caff018b7f1e8fd481eb1c50d75b0ef236bcd5078b1d15c8bb348453fee30293
7-
robots.txt,1599684669141,391d14b3c2f8c9143a27a28c7399585142228d4d1bdbe2c87ac946de411fa9a2
8-
static/css/main.aa2a782b.chunk.css,1599684733908,4727d74726c7785384c4421fd4a2ed0ddedadaf534c722d5faea43dd88169b03
9-
static/js/2.7a5bdb65.chunk.js.LICENSE.txt,1599684733908,08ab60bed8cd490b3869df351addc1da53b222e47a66b05f6222f028898f5418
10-
static/css/main.aa2a782b.chunk.css.map,1599684733940,e518b61c7c887830bdc1bbe317c29b0875ed0b3b9ead16173af2e2065ca9fc9d
11-
static/js/runtime-main.90140090.js,1599684733941,b3f3a8a9f70379c94ea30351ba56aed9176e1270aaeae6eb617542109699eaa4
12-
static/js/main.fa2ce1d9.chunk.js,1599684733940,370d9c7c963d143ad8cbb7ae8da2b4a621a833b55fdf3e842fbb84916f3761ce
13-
static/js/runtime-main.90140090.js.map,1599684733940,91dbda10cc30ea2728c4411f8987bcc8e5150c5e5b7f0f41ffcf0a6be812ac74
14-
service-worker.js,1599684733907,6d3670de859fc89a0a7d01d6c3e54e13acaa99bf226c521cddd0057f69150c34
15-
logo512.png,1599684669139,191fc21360b4ccfb1cda11a1efb97f489ed22672ca83f4064316802bbfdd750e
16-
static/js/main.fa2ce1d9.chunk.js.map,1599684733940,00875722c2da003542d06212c14cb6fd644fc5bd555fd337807beddf2edb49d6
17-
static/js/2.7a5bdb65.chunk.js,1599684733941,d5ca951cfbed4a0ce2525b9d906dd58ae5aa1137b4e9bf5d6bf3072b550ff487
18-
static/js/2.7a5bdb65.chunk.js.map,1599684733943,324612096b87a51d161de0dd314575b085dc852aeeae035f39317732b7d321a8
1+
asset-manifest.json,1599776728559,59b46113d66ab1901a78d5778a8f722900223ac3e65dc49b62f16827594ba3cd
2+
favicon.ico,1599776713939,a08fa4488c3ecef62d9effd03b3a989929bdcbecf5e905941f9034a15bd3dba3
3+
index.html,1599776728559,9ce7cd4d46792e1444f83eaeb3246c69dee65147f92615a1f800755acc2c77bb
4+
logo192.png,1599776713940,caff018b7f1e8fd481eb1c50d75b0ef236bcd5078b1d15c8bb348453fee30293
5+
logo512.png,1599776713940,191fc21360b4ccfb1cda11a1efb97f489ed22672ca83f4064316802bbfdd750e
6+
manifest.json,1599776713941,341d52628782f8ac9290bbfc43298afccb47b7cbfcee146ae30cf0f46bc30900
7+
precache-manifest.c81fccfda0b7dff79ead27c338eb4a09.js,1599776728559,9327eecc459bbfa8a1f0d5c72a1cfcf1ea656826b6272bcfa1aefbd5ecd961f4
8+
robots.txt,1599776713941,391d14b3c2f8c9143a27a28c7399585142228d4d1bdbe2c87ac946de411fa9a2
9+
service-worker.js,1599776728559,227d11ff29d9e74e143b139e1c592bad5506a449c0f4f3e574f4240a9b6cfbcc
10+
static/css/main.78c7c615.chunk.css,1599776728576,2431bc9c464210001de03c80acf62fce7680206e6b8d0eb4d3828d17efb85918
11+
static/css/main.78c7c615.chunk.css.map,1599776728577,e58dd8ca28258ad5266999044120c5437ed9585d293a96dfb37c2ce0de227fd2
12+
static/js/2.1152b9cd.chunk.js,1599776728578,1488be6c3f2de748f7f2b0c47a8e57fb434779ea38d0185fea6c0377ca4867db
13+
static/js/2.1152b9cd.chunk.js.LICENSE.txt,1599776728576,8aa9e4bf5a9536903cea4d4861ddf5638027cff5b1de4d1ea4ba230e1e47fd7e
14+
static/js/2.1152b9cd.chunk.js.map,1599776728577,448e536247e44c250f77f479b060588d1bc77bea46b643efe700cb3181f4e9b0
15+
static/js/main.ecc1d7a2.chunk.js,1599776728559,cfddc4e3e20bd50710f4258c7b7e2e03be21c49c13648bdefe48843cbe5fbfd2
16+
static/js/main.ecc1d7a2.chunk.js.map,1599776728578,e0fe7992df9fa3daa6d206c030d8e046863609a6cbdc4d7ea10f34ab9d60ccd3
17+
static/js/runtime-main.90140090.js,1599776728578,b3f3a8a9f70379c94ea30351ba56aed9176e1270aaeae6eb617542109699eaa4
18+
static/js/runtime-main.90140090.js.map,1599776728579,91dbda10cc30ea2728c4411f8987bcc8e5150c5e5b7f0f41ffcf0a6be812ac74

Diff for: firebase.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"firebase.json",
66
"**/.*",
77
"**/node_modules/**"
8-
],
9-
"rewrites": [
10-
{
11-
"source": "**",
12-
"destination": "/index.html"
13-
}
148
]
9+
},
10+
"functions": {
11+
"predeploy": [
12+
"npm --prefix \"$RESOURCE_DIR\" run lint"
13+
],
14+
"source": "functions"
1515
}
1616
}

Diff for: functions/.eslintrc.json

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{
2+
"parserOptions": {
3+
// Required for certain syntax usages
4+
"ecmaVersion": 2017
5+
},
6+
"plugins": [
7+
"promise"
8+
],
9+
"extends": "eslint:recommended",
10+
"rules": {
11+
// Removed rule "disallow the use of console" from recommended eslint rules
12+
"no-console": "off",
13+
14+
// Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
15+
"no-regex-spaces": "off",
16+
17+
// Removed rule "disallow the use of debugger" from recommended eslint rules
18+
"no-debugger": "off",
19+
20+
// Removed rule "disallow unused variables" from recommended eslint rules
21+
"no-unused-vars": "off",
22+
23+
// Removed rule "disallow mixed spaces and tabs for indentation" from recommended eslint rules
24+
"no-mixed-spaces-and-tabs": "off",
25+
26+
// Removed rule "disallow the use of undeclared variables unless mentioned in /*global */ comments" from recommended eslint rules
27+
"no-undef": "off",
28+
29+
// Warn against template literal placeholder syntax in regular strings
30+
"no-template-curly-in-string": 1,
31+
32+
// Warn if return statements do not either always or never specify values
33+
"consistent-return": 1,
34+
35+
// Warn if no return statements in callbacks of array methods
36+
"array-callback-return": 1,
37+
38+
// Require the use of === and !==
39+
"eqeqeq": 2,
40+
41+
// Disallow the use of alert, confirm, and prompt
42+
"no-alert": 2,
43+
44+
// Disallow the use of arguments.caller or arguments.callee
45+
"no-caller": 2,
46+
47+
// Disallow null comparisons without type-checking operators
48+
"no-eq-null": 2,
49+
50+
// Disallow the use of eval()
51+
"no-eval": 2,
52+
53+
// Warn against extending native types
54+
"no-extend-native": 1,
55+
56+
// Warn against unnecessary calls to .bind()
57+
"no-extra-bind": 1,
58+
59+
// Warn against unnecessary labels
60+
"no-extra-label": 1,
61+
62+
// Disallow leading or trailing decimal points in numeric literals
63+
"no-floating-decimal": 2,
64+
65+
// Warn against shorthand type conversions
66+
"no-implicit-coercion": 1,
67+
68+
// Warn against function declarations and expressions inside loop statements
69+
"no-loop-func": 1,
70+
71+
// Disallow new operators with the Function object
72+
"no-new-func": 2,
73+
74+
// Warn against new operators with the String, Number, and Boolean objects
75+
"no-new-wrappers": 1,
76+
77+
// Disallow throwing literals as exceptions
78+
"no-throw-literal": 2,
79+
80+
// Require using Error objects as Promise rejection reasons
81+
"prefer-promise-reject-errors": 2,
82+
83+
// Enforce “for” loop update clause moving the counter in the right direction
84+
"for-direction": 2,
85+
86+
// Enforce return statements in getters
87+
"getter-return": 2,
88+
89+
// Disallow await inside of loops
90+
"no-await-in-loop": 2,
91+
92+
// Disallow comparing against -0
93+
"no-compare-neg-zero": 2,
94+
95+
// Warn against catch clause parameters from shadowing variables in the outer scope
96+
"no-catch-shadow": 1,
97+
98+
// Disallow identifiers from shadowing restricted names
99+
"no-shadow-restricted-names": 2,
100+
101+
// Enforce return statements in callbacks of array methods
102+
"callback-return": 2,
103+
104+
// Require error handling in callbacks
105+
"handle-callback-err": 2,
106+
107+
// Warn against string concatenation with __dirname and __filename
108+
"no-path-concat": 1,
109+
110+
// Prefer using arrow functions for callbacks
111+
"prefer-arrow-callback": 1,
112+
113+
// Return inside each then() to create readable and reusable Promise chains.
114+
// Forces developers to return console logs and http calls in promises.
115+
"promise/always-return": 2,
116+
117+
//Enforces the use of catch() on un-returned promises
118+
"promise/catch-or-return": 2,
119+
120+
// Warn against nested then() or catch() statements
121+
"promise/no-nesting": 1
122+
}
123+
}

Diff for: functions/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

Diff for: functions/index.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const functions = require("firebase-functions");
2+
const express = require("express");
3+
const cors = require("cors");
4+
const stripe = require("stripe")(
5+
"sk_test_51HPvU9DFg5koCdLGeOEiFvwHat4v8eMjX6SY0YCwxPBQBUPhKy1fPVhiSM5cQtgW7QBG9ydQcXnW57TDxVE2f3H000HSfmEQZF"
6+
);
7+
8+
// API
9+
10+
// - App config
11+
const app = express();
12+
13+
// - Middlewares
14+
app.use(cors({ origin: true }));
15+
app.use(express.json());
16+
17+
// - API routes
18+
app.get("/", (request, response) => response.status(200).send("hello world"));
19+
20+
app.post("/payments/create", async (request, response) => {
21+
const total = request.query.total;
22+
23+
console.log("Payment Request Recieved BOOM!!! for this amount >>> ", total);
24+
25+
const paymentIntent = await stripe.paymentIntents.create({
26+
amount: total, // subunits of the currency
27+
currency: "usd",
28+
});
29+
30+
// OK - Created
31+
response.status(201).send({
32+
clientSecret: paymentIntent.client_secret,
33+
});
34+
});
35+
36+
// - Listen command
37+
exports.api = functions.https.onRequest(app);
38+
39+
// Example endpoint
40+
// http://localhost:5001/challenge-4b2b2/us-central1/api

0 commit comments

Comments
 (0)