This repository was archived by the owner on Sep 12, 2019. It is now read-only.
File tree 2 files changed +8
-21
lines changed
functions-templates/js/fauna-graphql
2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -117,19 +117,11 @@ module.exports.serverSettings = async devConfig => {
117
117
) ; // if settings.command is empty, its bc no settings matched
118
118
}
119
119
if ( devConfig . port ) {
120
- settings . proxyPort = assignLoudly (
121
- devConfig . port ,
122
- settings . proxyPort || null ,
123
- tellUser ( "proxyPort" )
124
- ) ; // if settings.proxyPort is empty, its bc no settings matched
120
+ settings . proxyPort = devConfig . port || settings . proxyPort ;
125
121
const regexp =
126
122
devConfig . urlRegexp ||
127
123
new RegExp ( `(http://)([^:]+:)${ devConfig . port } (/)?` , "g" ) ;
128
- settings . urlRegexp = assignLoudly (
129
- settings . urlRegexp ,
130
- regexp ,
131
- tellUser ( "urlRegexp" )
132
- ) ;
124
+ settings . urlRegexp = settings . urlRegexp || regexp ;
133
125
}
134
126
settings . dist = devConfig . publish || settings . dist ; // dont loudassign if they dont need it
135
127
}
Original file line number Diff line number Diff line change @@ -7,15 +7,14 @@ function createFaunaGraphQL() {
7
7
}
8
8
console . log ( "Upload GraphQL Schema!" ) ;
9
9
10
- var request = require ( "request " ) ;
10
+ const fetch = require ( "node-fetch " ) ;
11
11
const fs = require ( "fs" ) ;
12
12
const path = require ( "path" ) ;
13
13
var dataString = fs
14
14
. readFileSync ( path . join ( __dirname , "schema.graphql" ) )
15
15
. toString ( ) ; // name of your schema file
16
16
17
17
var options = {
18
- url : "https://graphql.fauna.com/import" ,
19
18
method : "POST" ,
20
19
body : dataString ,
21
20
auth : {
@@ -24,16 +23,12 @@ function createFaunaGraphQL() {
24
23
}
25
24
} ;
26
25
27
- request ( options , callback ) ;
28
-
29
- function callback ( error , response , body ) {
30
- if ( ! error && response . statusCode == 200 ) {
31
- // // for debugging
26
+ fetch ( "https://graphql.fauna.com/import" , options )
27
+ . then ( body => {
28
+ // // uncomment for debugging
32
29
// console.log("body", body);
33
- } else {
34
- console . error ( "something wrong happened: " , { error, body } ) ;
35
- }
36
- }
30
+ } )
31
+ . catch ( err => console . error ( "something wrong happened: " , { err } ) ) ;
37
32
}
38
33
39
34
createFaunaGraphQL ( ) ;
You can’t perform that action at this time.
0 commit comments