
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
moleculer-adapter-feathers
Advanced tools
Moleculer adapter to import feathers services. That includes:
$ npm install moleculer-adapter-feathers --save
const Feathers = require("moleculer-adapter-feathers");
const { ServiceBroker } = require("moleculer");
const feathersKnex = require("feathers-knex");
const knex = require("knex");
const broker = new ServiceBroker();
// Create a DB service via knex for `user` entities
broker.createService({
name: "users",
mixins: [Feathers],
settings: {
feathers: {
adapter: feathersKnex,
options: {
name: "users",
Model: new knex({
client: "pg",
connection: { ... },
}),
},
},
},
});
broker.start()
// Create a new user
.then(() => broker.call("users.create", {
username: "john",
email: "john@doe.com",
}))
// Get all users
.then(() => broker.call("users.find").then(console.log));
| Property | Type | Default | Description |
|---|---|---|---|
adapter | `Object | Function` | required |
hooks | Object | {} | Object containing before and after hooks. |
options | Object | {} | Options passed to Feathers service adapter. |
Hooks work just as they do in Feathers. They are passed down to a service in settings.feathers.hooks.
users.service.jsmodule.exports = {
...
settings: {
feathers: {
adapter: feathersKnex,
hooks: require('./hooks'),
options: {
name: "users",
Model: new knex({
client: "pg",
connection: { ... },
}),
},
},
},
...
}
hooks.jsmodule.exports = {
before: {
create: [
hook => {
console.log('create hook')
return hook
},
],
find: [],
get: [],
update: [],
patch: [],
remove: [],
},
after: {
create: [],
find: [],
get: [],
update: [],
patch: [],
remove: [],
},
}
Standard Feathers actions are exposed: create, get, find, update, patch, remove with all the standard Feathers parameters. Actions can be overwritten.
Feathers service methods can be accessed directly via this.create, this.find and etc.
createCreate an object in a service.
| Property | Type | Default | Description |
|---|---|---|---|
* | Any | {} | Object to be created. |
Type: Object
Created object (or any other service response).
findFind objects by a provided query, if any.
| Property | Type | Default | Description |
|---|---|---|---|
* | Any | {} | Query specified by the service. |
Type: Array[Object]
Array of results.
getGet object in the service by a provided (unique) ID.
| Property | Type | Default | Description |
|---|---|---|---|
id | `String | Number` | required |
Type: Object
Object found by the ID.
patchChanges the properties of an object.
| Property | Type | Default | Description |
|---|---|---|---|
id | `String | Number` | required |
* | Any | {} | Values to be patched. |
Type: Object
Object patched.
updateOverwrites an object's properties.
| Property | Type | Default | Description |
|---|---|---|---|
id | `String | Number` | required |
* | Any | {} | Rest of the object. |
Type: Object
Object updated.
removeRemove object by ID.
| Property | Type | Default | Description |
|---|---|---|---|
id | `String | Number` | required |
Type: Object
Object removed.
FAQs
Moleculer service mixin adapting Feathers.js services
We found that moleculer-adapter-feathers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.