Skip to content

Commit 46fd89d

Browse files
committed
Added dotenv configuration for environment variables
1 parent 0ccb7eb commit 46fd89d

File tree

7 files changed

+1983
-19
lines changed

7 files changed

+1983
-19
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
.env

Diff for: .idea/modules.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

Diff for: package.json

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "donation-app-server",
2+
"name": "stripe-payment",
33
"version": "1.0.0",
4-
"description": "Donation app server using Node with TypeScript, Express, and Stripe",
4+
"description": "Stripe payment using Node with TypeScript, Express, and Stripe",
55
"main": "./src/app.ts",
66
"scripts": {
77
"dev": "nodemon ./src/app.ts",
88
"start": "node ./dist/app.js"
99
},
1010
"keywords": [
11-
"Donation App",
11+
"Payment",
1212
"TypeScript",
1313
"Node",
1414
"Express",
@@ -17,6 +17,11 @@
1717
"author": "gigaamiridze",
1818
"license": "ISC",
1919
"devDependencies": {
20+
"@babel/cli": "^7.22.10",
21+
"@babel/core": "^7.22.11",
22+
"@babel/node": "^7.22.10",
23+
"@babel/preset-env": "^7.22.10",
24+
"@babel/runtime": "^7.22.11",
2025
"@types/cors": "^2.8.13",
2126
"@types/express": "^4.17.17",
2227
"@types/morgan": "^1.9.5",
@@ -27,7 +32,9 @@
2732
},
2833
"dependencies": {
2934
"cors": "^2.8.5",
35+
"dotenv": "^16.3.1",
3036
"express": "^4.18.2",
31-
"morgan": "^1.10.0"
37+
"morgan": "^1.10.0",
38+
"stripe": "^13.3.0"
3239
}
3340
}

Diff for: src/app.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import express, { Application, Request, Response } from 'express';
22
import morgan from 'morgan';
33
import cors from 'cors';
4+
import { PORT, STRIPE_PUBLISHABLE_KEY, STRIPE_SECRET_KEY } from './env';
45

56
const app: Application = express();
6-
const port = 5000;
77

88
app.use(cors());
99
app.use(morgan('dev'));
@@ -13,6 +13,6 @@ app.get('/', (req: Request, res: Response) => {
1313
res.send('Hello, World!');
1414
});
1515

16-
app.listen(port, () => {
17-
console.log(`Server listening on port ${port}`);
16+
app.listen(PORT, () => {
17+
console.log(`Server listening on port ${PORT}`);
1818
});

Diff for: src/env.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import dotenv from 'dotenv';
2+
3+
dotenv.config();
4+
5+
export const { PORT, STRIPE_PUBLISHABLE_KEY, STRIPE_SECRET_KEY } = process.env;

Diff for: yarn.lock

+1,962-11
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)