File tree Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 44 "node" : true
55 },
66 "extends" : [
7- " airbnb-base"
7+ " airbnb-base" ,
8+ " prettier" ,
9+ " plugin:import/typescript"
810 ],
911 "parser" : " @typescript-eslint/parser" ,
1012 "parserOptions" : {
1517 " @typescript-eslint"
1618 ],
1719 "rules" : {
20+ "import/extensions" : " off" ,
21+ "import/prefer-default-export" : " off"
1822 }
19- }
23+ }
Original file line number Diff line number Diff line change 44 "description" : " An api to track Full Stack Overflow Developer Q&A" ,
55 "main" : " index.js" ,
66 "scripts" : {
7- "start:dev" : " NODE_ENV=dev nodemon --watch \" src/**\" --ext \" ts,json\" --exec \" ts-node src/server.ts\" " ,
8- "dev" : " tsc --watch"
7+ "start:dev" : " NODE_ENV=dev nodemon --watch \" src/**\" --ext \" ts,json\" --exec \" ts-node src/server.ts\" "
98 },
109 "repository" : {
1110 "type" : " git" ,
3736 "@typescript-eslint/parser" : " ^5.6.0" ,
3837 "eslint" : " ^8.4.1" ,
3938 "eslint-config-airbnb-base" : " ^15.0.0" ,
39+ "eslint-config-prettier" : " ^8.3.0" ,
4040 "eslint-plugin-import" : " ^2.25.3" ,
4141 "git-commit-msg-linter" : " ^3.2.8" ,
4242 "nodemon" : " ^2.0.15" ,
43+ "prettier" : " ^2.5.1" ,
4344 "ts-node" : " ^10.4.0" ,
4445 "typescript" : " ^4.5.3"
4546 }
Original file line number Diff line number Diff line change 1+ import { Pool , PoolConfig } from 'pg' ;
2+
3+ let connectionData : PoolConfig = {
4+ user : process . env . DB_USER ,
5+ password : process . env . DB_PASS ,
6+ port : Number ( process . env . DB_PORT ) ,
7+ host : process . env . DB_HOST ,
8+ database : process . env . DB_NAME ,
9+ } ;
10+
11+ if ( process . env . NODE_ENV === 'prod' ) {
12+ connectionData = {
13+ connectionString : process . env . DATABASE_URL ,
14+ ssl : {
15+ rejectUnauthorized : false ,
16+ } ,
17+ } ;
18+ }
19+
20+ const connection = new Pool ( connectionData ) ;
21+
22+ export default connection ;
Original file line number Diff line number Diff line change @@ -2,5 +2,6 @@ import app from './app';
22import './setup' ;
33
44app . listen ( process . env . PORT , ( ) => {
5+ // eslint-disable-next-line no-console
56 console . log ( `Server is running on port ${ process . env . PORT } ` ) ;
67} ) ;
You can’t perform that action at this time.
0 commit comments