Skip to content

Commit

Permalink
add debug and setCustomLoginPath
Browse files Browse the repository at this point in the history
  • Loading branch information
sguilly committed May 15, 2018
1 parent 460a96e commit f1675b1
Show file tree
Hide file tree
Showing 11 changed files with 5,443 additions and 258 deletions.
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,39 @@ loopbackClientWithAuth.createToken()

```

## Methods
### With custom login path

```js


var loopbackClientWithAuth = new LoopbackClient('http://localhost:3000/api','xxx EMAIL USER xxx', 'xxx PASSWORD xxx')


// Default Value is : '/users/login?include=user'
loopbackClientWithAuth.setCustomLoginPath('/user/login?include=user')

loopbackClientWithAuth.createToken()
.then(function()
{

var Customers = loopbackClientWithAuth.getModel('customers')

Customers.count({where: {name: 'ido4pro'}})
.then(function (customers) {
console.log(customers)

})
.catch(function (err) {
console.log(err)
})

})

```

# Methods

Try to be compliant with https://loopback.io/doc/en/lb3/Working-with-data.html

create(data) --> data = { id: 'xxx', filter: {...} } (filter is optional)

Expand All @@ -132,7 +164,15 @@ loopbackClientWithAuth.createToken()
Check the test/index.js for more usage


## License
# DEBUG

This lib use debug (https://github.com/visionmedia/debug) to log request

Activate log trace with environment variable "DEBUG=LoopBackClient"

example : DEBUG=LoopBackClient npm run test

# License

MIT © [Stéphane GUILLY](http://github.com/sguilly)

Expand Down
75 changes: 0 additions & 75 deletions dist/LoopbackClient.js

This file was deleted.

161 changes: 0 additions & 161 deletions dist/LoopbackModel.js

This file was deleted.

9 changes: 0 additions & 9 deletions dist/index.js

This file was deleted.

Loading

0 comments on commit f1675b1

Please sign in to comment.