File tree 3 files changed +8
-18
lines changed
3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change 1
1
node_modules
2
2
package-lock.json
3
3
nohup.out
4
- build
4
+ build
5
+ config.json
6
+ .vscode
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,15 +5,7 @@ const typeDefs = require("./schema");
5
5
const resolvers = require ( "./resolvers" ) ;
6
6
const SQLSource = require ( "./sql_datasource" ) ;
7
7
const fs = require ( "fs" ) ;
8
- const ws = require ( "ws" ) ;
9
- const socket_server_port = 5000 ;
10
- //const dbSource = require('./db')
11
-
12
- //websocket server stuff
13
-
14
-
15
-
16
- //apollo graph ql stuff
8
+ const credentials = require ( "../config.json" ) ;
17
9
var db = createStore ( ) ;
18
10
19
11
const server = new ApolloServer ( {
@@ -23,16 +15,16 @@ const server = new ApolloServer({
23
15
"db" : new SQLSource ( db )
24
16
} ) ,
25
17
context : ( { req} ) => {
26
- if ( req . headers . authorization != "bread123" ) throw new Error ( "Unauthorized" ) ;
18
+ if ( req . headers . authorization != credentials . pass ) throw new Error ( "Unauthorized" ) ;
27
19
}
28
20
} ) ;
29
21
30
22
function createStore ( ) {
31
23
var db = mysql . createConnection ( {
32
24
host : 'localhost' ,
33
- user : 'root' ,
34
- password : 'bread123' ,
35
- database : 'test_db' ,
25
+ user : credentials . db_user ,
26
+ password : credentials . db_pass ,
27
+ database : credentials . db_name ,
36
28
insecureAuth : true ,
37
29
multipleStatements : true
38
30
} )
You can’t perform that action at this time.
0 commit comments