Skip to content

Commit a0c3501

Browse files
Merge pull request #69 from terminusdb/fixConnectDb
updated connect api url
2 parents b2b6809 + a5dbdbf commit a0c3501

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

docs/api/woqlClient.js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ or the promise will be rejected.
6060

6161
**Example**
6262
```js
63-
client.connect({key:"mykey",user:"admin"})
63+
client.connect()
6464
```
6565

6666
### Create Database

lib/connectionConfig.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ ConnectionConfig.prototype.apiURL = function() {
123123
return this.server + this.api_extension
124124
}
125125

126+
/**
127+
* Gets the server connection url info
128+
* @returns {string}
129+
*/
130+
ConnectionConfig.prototype.apiURLInfo = function() {
131+
return this.apiURL() + "info"
132+
}
133+
126134
/**
127135
* Gets the current database id
128136
* @returns {string | boolean}

lib/woqlClient.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,12 @@ WOQLClient.prototype.resource = function(resourceType, resourceId) {
349349
* @param {typedef.ParamsObj} [params] - TerminusDB Server connection parameters
350350
* @returns {Promise} the connection capabilities response object or an error object
351351
* @example
352-
* client.connect({key:"mykey",user:"admin"})
352+
* client.connect()
353353
*/
354354
WOQLClient.prototype.connect = function(params) {
355355
if (params) this.connectionConfig.update(params)
356356
// unset the current server setting until successful connect
357-
return this.dispatch(CONST.GET, this.api()).then(response => {
357+
return this.dispatch(CONST.GET, this.connectionConfig.apiURLInfo()).then(response => {
358358
this.databases(response)
359359
return response
360360
})

0 commit comments

Comments
 (0)