Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit cbe87d0

Browse files
committed
* Updated project to use FeathersJS v3
* Updated docs on `$joinEager`
1 parent fbae9f4 commit cbe87d0

File tree

7 files changed

+332
-313
lines changed

7 files changed

+332
-313
lines changed

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# feathers-objection
22

33
[![Build Status](https://travis-ci.org/mcchrish/feathers-objection.svg?branch=master)](https://travis-ci.org/mcchrish/feathers-objection)
4-
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
4+
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://standardjs.com/)
55
[![Dependency Status](https://img.shields.io/david/mcchrish/feathers-objection.svg)](https://david-dm.org/mcchrish/feathers-objection)
66
[![npm](https://img.shields.io/npm/v/feathers-objection.svg?maxAge=2592000)](https://www.npmjs.com/package/feathers-objection)
77

8-
> An [Objection.js](http://vincit.github.io/objection.js) service adapter for [FeathersJS](http://feathersjs.com)
8+
> An [Objection.js](https://vincit.github.io/objection.js) service adapter for [FeathersJS](https://feathersjs.com)
99
1010

1111
## Installation
@@ -16,13 +16,13 @@ npm install feathers-objection --save
1616

1717
## Documentation
1818

19-
Please refer to the [Feathers database adapter documentation](http://docs.feathersjs.com/databases/readme.html) for more details or directly at:
19+
Please refer to the [Feathers database adapter documentation](https://docs.feathersjs.com/databases/readme.html) for more details or directly at:
2020

21-
- [Extending](http://docs.feathersjs.com/databases/extending.html) - How to extend a database adapter
22-
- [Pagination and Sorting](http://docs.feathersjs.com/databases/pagination.html) - How to use pagination and sorting for the database adapter
23-
- [Querying](http://docs.feathersjs.com/databases/querying.html) - The common adapter querying mechanism
21+
- [Extending](https://docs.feathersjs.com/databases/extending.html) - How to extend a database adapter
22+
- [Pagination and Sorting](https://docs.feathersjs.com/databases/pagination.html) - How to use pagination and sorting for the database adapter
23+
- [Querying](https://docs.feathersjs.com/databases/querying.html) - The common adapter querying mechanism
2424

25-
Refer to the official [Objection.js documention](http://vincit.github.io/objection.js).
25+
Refer to the official [Objection.js documention](https://vincit.github.io/objection.js).
2626

2727
It works almost the same as the [Knex
2828
service](https://github.com/feathersjs/feathers-knex) adapter, except it has all
@@ -69,25 +69,25 @@ Feathers services, instead of relying with hooks.
6969
Note that all this eager related options are optional.
7070
7171
* **`allowedEager`** - relation expression to limit the allowed eager queries in
72-
the service. Defaults to `'[]'`, meaning no eager queries allowed. See [`allowEager`](http://vincit.github.io/objection.js/#alloweager) documentation.
72+
the service. Defaults to `'[]'`, meaning no eager queries allowed. See [`allowEager`](https://vincit.github.io/objection.js/#alloweager) documentation.
7373
* **`eagerFilters`** - option to impose compulsory eager filter. It takes an
7474
object or array of objects with the following properties:
7575
* `expression` - the relation expression that the filter will be applied.
7676
* `filter` - the filter function.
77-
It uses [`filterEager`](http://vincit.github.io/objection.js/#filtereager) internally.
77+
It uses [`filterEager`](https://vincit.github.io/objection.js/#filtereager) internally.
7878
* **`namedEagerFilters`** - object containing named eager filter functions.
7979
Filter is opt-in via `$eager` parameter.
8080
8181
#### Service call parameters
8282
8383
* **`$eager`** - parameter to eager load relations defined in `namedEagerFilters`. See
84-
[`eager`](http://vincit.github.io/objection.js/#eager) documentation.
85-
84+
[`eager`](https://vincit.github.io/objection.js/#eager) documentation.
8685
* **`$joinRelation`** - parameter to filter based on a relation's field. See
87-
[`joinRelation`](http://vincit.github.io/objection.js/#joinrelation) documentation.
88-
86+
[`joinRelation`](https://vincit.github.io/objection.js/#joinrelation) documentation.
87+
* **`$joinEager`** - parameter to filter based on a relation's field using `JoinEagerAlgorithm`. See
88+
[`$joinEager`](https://vincit.github.io/objection.js/#joineager) documentation.
8989
* **`$pick`** - parameter to pick properties from result models. See
90-
[`pick`](http://vincit.github.io/objection.js/#pick) documentation.
90+
[`pick`](https://vincit.github.io/objection.js/#pick) documentation.
9191
9292
Example:
9393
@@ -158,11 +158,12 @@ app.service('/user-todos').get({ userId: 1, todoId: 2 });
158158
159159
## Complete Example
160160
161-
Here's a complete example of a Feathers server with a `todos` SQLite service. We are using the [Knex schema builder](http://knexjs.org/#Schema).
161+
Here's a complete example of a Feathers server with a `todos` SQLite service. We are using the [Knex schema builder](https://knexjs.org/#Schema).
162162
163163
```js
164-
import feathers from 'feathers'
165-
import rest from 'feathers-rest'
164+
import feathers from '@feathersjs/feathers'
165+
import express from '@feathersjs/express'
166+
import rest from '@feathersjs/express/rest'
166167
import bodyParser from 'body-parser'
167168
import ObjectionService from '../lib'
168169
import { Model } from 'objection'
@@ -171,7 +172,8 @@ const knex = require('knex')({
171172
client: 'sqlite3',
172173
connection: {
173174
filename: './db.sqlite'
174-
}
175+
},
176+
useNullAsDefault: false
175177
})
176178

177179
// Bind Objection.js
@@ -192,7 +194,7 @@ knex.schema.dropTableIfExists('todos').then(function () {
192194
})
193195

194196
// Create a feathers instance.
195-
const app = feathers()
197+
const app = express(feathers())
196198
// Enable REST services
197199
.configure(rest())
198200
// Turn on JSON parser for REST services

example/app.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import feathers from 'feathers'
2-
import rest from 'feathers-rest'
1+
import feathers from '@feathersjs/feathers'
2+
import express from '@feathersjs/express'
3+
import rest from '@feathersjs/express/rest'
34
import bodyParser from 'body-parser'
45
import ObjectionService from '../lib'
56
import { Model } from 'objection'
@@ -9,7 +10,8 @@ const knex = require('knex')({
910
client: 'sqlite3',
1011
connection: {
1112
filename: './db.sqlite'
12-
}
13+
},
14+
useNullAsDefault: false
1315
})
1416

1517
// Bind Objection.js
@@ -30,7 +32,7 @@ knex.schema.dropTableIfExists('todos').then(function () {
3032
})
3133

3234
// Create a feathers instance.
33-
const app = feathers()
35+
const app = express(feathers())
3436
// Enable REST services
3537
.configure(rest())
3638
// Turn on JSON parser for REST services

0 commit comments

Comments
 (0)