File tree 4 files changed +32
-4
lines changed
4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 4
4
"node" : true
5
5
},
6
6
"extends" : [
7
- " airbnb-base"
7
+ " airbnb-base" ,
8
+ " prettier" ,
9
+ " plugin:import/typescript"
8
10
],
9
11
"parser" : " @typescript-eslint/parser" ,
10
12
"parserOptions" : {
15
17
" @typescript-eslint"
16
18
],
17
19
"rules" : {
20
+ "import/extensions" : " off" ,
21
+ "import/prefer-default-export" : " off"
18
22
}
19
- }
23
+ }
Original file line number Diff line number Diff line change 4
4
"description" : " An api to track Full Stack Overflow Developer Q&A" ,
5
5
"main" : " index.js" ,
6
6
"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\" "
9
8
},
10
9
"repository" : {
11
10
"type" : " git" ,
37
36
"@typescript-eslint/parser" : " ^5.6.0" ,
38
37
"eslint" : " ^8.4.1" ,
39
38
"eslint-config-airbnb-base" : " ^15.0.0" ,
39
+ "eslint-config-prettier" : " ^8.3.0" ,
40
40
"eslint-plugin-import" : " ^2.25.3" ,
41
41
"git-commit-msg-linter" : " ^3.2.8" ,
42
42
"nodemon" : " ^2.0.15" ,
43
+ "prettier" : " ^2.5.1" ,
43
44
"ts-node" : " ^10.4.0" ,
44
45
"typescript" : " ^4.5.3"
45
46
}
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';
2
2
import './setup' ;
3
3
4
4
app . listen ( process . env . PORT , ( ) => {
5
+ // eslint-disable-next-line no-console
5
6
console . log ( `Server is running on port ${ process . env . PORT } ` ) ;
6
7
} ) ;
You can’t perform that action at this time.
0 commit comments