Skip to content

Commit

Permalink
Add concurrently and env
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianponce89 committed Oct 2, 2020
1 parent 11900fa commit ef21340
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
build/
remo-tables-firebase.json
.env.local
.env.local
.env
112 changes: 111 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
"@types/node": "^14.0.13",
"@types/react": "^16.9.36",
"@types/react-dom": "^16.9.8",
"@types/react-notifications-component": "^2.4.0",
"@types/react-redux": "^7.1.9",
"@types/react-router-dom": "^5.1.5",
"body-parser": "^1.19.0",
"concurrently": "^5.3.0",
"connected-react-router": "^6.8.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"firebase": "^7.15.1",
"firebase-admin": "^9.2.0",
Expand All @@ -32,7 +35,8 @@
"typescript": "^3.9.5"
},
"scripts": {
"start": "react-scripts start",
"start": "concurrently \"ts-node ./server/app\" \"react-scripts start\"",
"react": "react-scripts start",
"start-server": "ts-node ./server/app",
"build": "react-scripts build",
"test": "react-scripts test",
Expand All @@ -55,7 +59,6 @@
},
"devDependencies": {
"@types/express": "^4.17.6",
"@types/react-notifications-component": "^2.4.0",
"ts-node": "^8.10.2"
}
}
2 changes: 2 additions & 0 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ async function decodeIDToken(req: any, res: any, next: any) {
}
next();
}

export {}
17 changes: 15 additions & 2 deletions server/config/firebase.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
require('dotenv').config()
const admin = require('firebase-admin');
const serviceAccount = require('./remo-tables-firebase.json');

module.exports = admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
credential: admin.credential.cert({
type: "service_account",
project_id: "remo-tables",
private_key_id: process.env.PRIVATE_KEY_ID,
private_key: (<string>process.env.PRIVATE_KEY).replace(/\\n/g, '\n'),
client_email: process.env.CLIENT_EMAIL,
client_id: process.env.CLIENT_ID,
auth_uri: "https://accounts.google.com/o/oauth2/auth",
token_uri: "https://oauth2.googleapis.com/token",
auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
client_x509_cert_url: "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-vl0n3%40remo-tables.iam.gserviceaccount.com"
}),
databaseURL: 'https://remo-tables.firebaseio.com',
});

export {}
1 change: 1 addition & 0 deletions server/controllers/tables.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,4 @@ module.exports = {
return res.status(201).json({ msg: 'Move to table', to: tableUID });
},
};
export {}
2 changes: 2 additions & 0 deletions server/controllers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ module.exports = {
email: `${Math.floor(Math.random() * 1000)}@${Math.floor(Math.random() * 1000)}.com`,
}),
};

export {}
2 changes: 2 additions & 0 deletions server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ router.post('/unassign-table', unAssignTable);
router.post('/move-table', moveTable);

module.exports = router;

export {}
2 changes: 1 addition & 1 deletion src/apis/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import firebase from 'firebase';

const API_URL = 'http://localhost:8000/';
const API_URL = <string>process.env.REACT_APP_API_URL;
const auth = firebase.auth();

export const sendGetRequest = async (endpoint: string) => {
Expand Down
11 changes: 8 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"outDir": "build/dist",
"module": "esnext",
"target": "es6",
"lib": ["es6", "dom"],
"lib": [
"es6",
"dom"
],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
Expand All @@ -17,7 +20,7 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"resolveJsonModule": true,
"isolatedModules": false,
"isolatedModules": true,
"noEmit": true,
"noImplicitReturns": true,
"noImplicitThis": true,
Expand All @@ -37,5 +40,7 @@
"src/__tests__/setupTests.ts",
"chrome-extension"
],
"include": ["src"]
"include": [
"src"
]
}

0 comments on commit ef21340

Please sign in to comment.